-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b11860b
commit a8fd87e
Showing
58 changed files
with
1,932 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import 'package:fish_repository/fish_repository.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:navis/explore/widgets/fish_card.dart'; | ||
|
||
class FishPage extends StatelessWidget { | ||
const FishPage({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Scaffold(body: FishView()); | ||
} | ||
} | ||
|
||
class FishView extends StatelessWidget { | ||
const FishView({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
const tabs = [ | ||
{'name': 'Deimos', 'region': FishingRegion.deimos}, | ||
{'name': 'Plains of Eidolon', 'region': FishingRegion.poe}, | ||
{'name': 'Orb Vallis', 'region': FishingRegion.vallis} | ||
]; | ||
|
||
return DefaultTabController( | ||
length: tabs.length, | ||
child: NestedScrollView( | ||
floatHeaderSlivers: true, | ||
headerSliverBuilder: (context, innerBoxIsScrolled) { | ||
// These are the slivers that show up in the "outer" scroll view. | ||
return <Widget>[ | ||
SliverOverlapAbsorber( | ||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), | ||
sliver: SliverAppBar( | ||
title: const Text('Fishing data'), | ||
floating: true, | ||
forceElevated: innerBoxIsScrolled, | ||
bottom: TabBar( | ||
tabs: | ||
tabs.map((r) => Tab(text: r['name']! as String)).toList(), | ||
), | ||
), | ||
), | ||
]; | ||
}, | ||
body: TabBarView( | ||
// These are the contents of the tab views, below the tabs. | ||
children: tabs.map((r) { | ||
return SafeArea( | ||
top: false, | ||
bottom: false, | ||
child: Builder( | ||
builder: (BuildContext context) { | ||
// ignore: strict_raw_type | ||
return FutureBuilder<List<Fish>>( | ||
// ignore: inference_failure_on_function_invocation | ||
future: loadFishResources(r['region']! as FishingRegion), | ||
builder: (context, snapshot) { | ||
if (!snapshot.hasData) { | ||
return const Center(child: CircularProgressIndicator()); | ||
} | ||
|
||
final data = snapshot.data; | ||
|
||
return CustomScrollView( | ||
key: PageStorageKey<String>(r['name']! as String), | ||
slivers: <Widget>[ | ||
SliverOverlapInjector( | ||
// This is the flip side of the SliverOverlapAbsorber | ||
// above. | ||
handle: | ||
NestedScrollView.sliverOverlapAbsorberHandleFor( | ||
context), | ||
), | ||
SliverPadding( | ||
padding: const EdgeInsets.all(8), | ||
sliver: SliverList( | ||
delegate: SliverChildBuilderDelegate( | ||
(BuildContext context, int index) { | ||
return FishCard(fish: data[index]); | ||
}, | ||
childCount: data!.length, | ||
), | ||
), | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
}, | ||
), | ||
); | ||
}).toList(), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
import 'package:fish_repository/fish_repository.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:navis_ui/navis_ui.dart'; | ||
|
||
class FishCard extends StatelessWidget { | ||
const FishCard({super.key, required this.fish}); | ||
|
||
// ignore: strict_raw_type | ||
final Fish fish; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
child: AnimatedContainer( | ||
duration: const Duration(milliseconds: 300), | ||
padding: const EdgeInsets.all(8), | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const CategoryTitle(title: 'Name'), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
fish.name, | ||
style: Theme.of(context).textTheme.titleMedium, | ||
), | ||
if (fish.small.standing != null) | ||
Text( | ||
'Standing: ' | ||
'${fish.small.standing}' | ||
'/${fish.medium.standing}' | ||
'/${fish.large.standing}', | ||
style: Theme.of(context).textTheme.titleSmall?.copyWith( | ||
color: Colors.grey[400], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
if (!fish.name.contains('Boot')) ...{ | ||
const CategoryTitle(title: 'Unique Resources'), | ||
_BuildUniqueResources(uniqueResources: fish.uniqueResources), | ||
}, | ||
if (!fish.name.contains('Boot')) ...{ | ||
const CategoryTitle(title: 'Resources S/M/L'), | ||
_BuildResources( | ||
small: fish.small.resources, | ||
medium: fish.medium.resources, | ||
large: fish.large.resources, | ||
), | ||
} | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _BuildUniqueResources<T> extends StatelessWidget { | ||
const _BuildUniqueResources({super.key, required this.uniqueResources}); | ||
|
||
final T uniqueResources; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Widget resources; | ||
if (uniqueResources is List<UniqueResource>) { | ||
resources = Wrap( | ||
children: (uniqueResources as List<UniqueResource>).map( | ||
(r) { | ||
return ColoredContainer( | ||
tooltip: r.name, | ||
child: Text(r.name), | ||
); | ||
}, | ||
).toList(), | ||
); | ||
} else { | ||
resources = ColoredContainer( | ||
tooltip: (uniqueResources as UniqueResource).name, | ||
child: Text((uniqueResources as UniqueResource).name), | ||
); | ||
} | ||
|
||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 14), | ||
child: resources, | ||
); | ||
} | ||
} | ||
|
||
class _BuildResources extends StatelessWidget { | ||
const _BuildResources({ | ||
required this.small, | ||
required this.medium, | ||
required this.large, | ||
}); | ||
|
||
final RegionResources small; | ||
final RegionResources medium; | ||
final RegionResources large; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Widget widget; | ||
// Check small and assume the reset are all from the same region. | ||
if (small is DeimosRegionResources) { | ||
final small = this.small as DeimosRegionResources; | ||
final medium = this.medium as DeimosRegionResources; | ||
final large = this.large as DeimosRegionResources; | ||
|
||
widget = Wrap( | ||
children: [ | ||
if (small.bladder > 1) | ||
ColoredContainer( | ||
tooltip: 'Bladder', | ||
child: Text( | ||
'Bladder: ' | ||
'${small.bladder}/${medium.bladder}/${large.bladder}', | ||
), | ||
), | ||
if (small.gills > 1) | ||
ColoredContainer( | ||
tooltip: 'Gills', | ||
child: Text( | ||
'Gills: ' | ||
'${small.gills}/${medium.gills}/${large.gills}', | ||
), | ||
), | ||
if (small.tumor > 1) | ||
ColoredContainer( | ||
tooltip: 'Tumor', | ||
child: Text( | ||
'Tumor: ' | ||
'${small.tumor}/${medium.tumor}/${large.tumor}', | ||
), | ||
), | ||
], | ||
); | ||
} else if (small is PoeRegionResources) { | ||
final small = this.small as PoeRegionResources; | ||
final medium = this.medium as PoeRegionResources; | ||
final large = this.large as PoeRegionResources; | ||
|
||
widget = Wrap( | ||
children: [ | ||
if (small.meat > 1) | ||
ColoredContainer( | ||
tooltip: 'Meat', | ||
child: Text( | ||
'Meat: ' | ||
'${small.meat}/${medium.meat}/${large.meat}', | ||
), | ||
), | ||
if (small.oil > 1) | ||
ColoredContainer( | ||
tooltip: 'Oil', | ||
child: Text( | ||
'Oil: ' | ||
'${small.oil}/${medium.oil}/${large.oil}', | ||
), | ||
), | ||
if (small.scales > 1) | ||
ColoredContainer( | ||
tooltip: 'Scales', | ||
child: Text( | ||
'Scales: ' | ||
'${small.scales}/${medium.scales}/${large.scales}', | ||
), | ||
), | ||
], | ||
); | ||
} else { | ||
final small = this.small as VallisRegionResources; | ||
final medium = this.medium as VallisRegionResources; | ||
final large = this.large as VallisRegionResources; | ||
|
||
widget = ColoredContainer( | ||
tooltip: 'Scrap', | ||
child: Text('Scrap: ${small.scrap}/${medium.scrap}/${large.scrap}'), | ||
); | ||
} | ||
|
||
return Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 14), | ||
child: widget, | ||
); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
packages/fish_repository/.github/ISSUE_TEMPLATE/bug_report.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
name: Bug Report | ||
about: Create a report to help us improve | ||
title: "fix: " | ||
labels: bug | ||
--- | ||
|
||
**Description** | ||
|
||
A clear and concise description of what the bug is. | ||
|
||
**Steps To Reproduce** | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected Behavior** | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
|
||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Additional Context** | ||
|
||
Add any other context about the problem here. |
Oops, something went wrong.