Skip to content

Commit

Permalink
Fix : Features
Browse files Browse the repository at this point in the history
Signed-off-by: LeoBruant <[email protected]>
  • Loading branch information
LeoBruant committed Jul 18, 2024
1 parent 9064ef4 commit 98de1f1
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions mobile/lib/screens/planets_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,8 @@ class _PlanetsScreenState extends State<PlanetsScreen> {

@override
Widget build(BuildContext context) {
final features = [
feature_enum.Feature.map,
feature_enum.Feature.planetList
];

if (features.isEmpty) {
return const Placeholder();
}

var tabLabels = [];

return DefaultTabController(
length: tabLabels.length,
length: 2,
child: Column(
children: [
Container(
Expand All @@ -75,7 +64,8 @@ class _PlanetsScreenState extends State<PlanetsScreen> {
),
child: TabBar(
tabs: [
...tabLabels.map((label) => Tab(text: label)),
Tab(text: AppLocalizations.of(context)!.map),
Tab(text: AppLocalizations.of(context)!.list),
],
),
),
Expand Down Expand Up @@ -224,25 +214,41 @@ class _ViewState extends State<_View> {
tabChildren.add(GalaxyMap(
planets: sortedPlanets,
));
} else {
tabChildren.add(ListTile(
title: Text(
AppLocalizations.of(context)!.planetsNoPlanets,
textAlign: TextAlign.center,
),
));
}

if (features.contains(feature_enum.Feature.planetList)) {
tabChildren.add(Container(
padding: const EdgeInsets.only(
left: _PlanetsScreenState.xPadding,
right: _PlanetsScreenState.xPadding,
bottom: _PlanetsScreenState.yPadding,
),
child: ListView.separated(
separatorBuilder: (context, index) => const SizedBox(
height: 8,
tabChildren.add(
Container(
padding: const EdgeInsets.only(
left: _PlanetsScreenState.xPadding,
right: _PlanetsScreenState.xPadding,
bottom: _PlanetsScreenState.yPadding,
),
itemCount: listItems.length,
itemBuilder: (context, index) {
final item = listItems[index];
child: ListView.separated(
separatorBuilder: (context, index) => const SizedBox(
height: 8,
),
itemCount: listItems.length,
itemBuilder: (context, index) {
final item = listItems[index];

return item.build(context);
},
return item.build(context);
},
),
),
);
} else {
tabChildren.add(ListTile(
title: Text(
AppLocalizations.of(context)!.planetsNoPlanets,
textAlign: TextAlign.center,
),
));
}
Expand All @@ -251,13 +257,6 @@ class _ViewState extends State<_View> {
physics: const NeverScrollableScrollPhysics(),
children: [
...tabChildren,
if (listItems.isEmpty)
ListTile(
title: Text(
AppLocalizations.of(context)!.planetsNoPlanets,
textAlign: TextAlign.center,
),
),
],
);
}
Expand Down

0 comments on commit 98de1f1

Please sign in to comment.