-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plans: fix what's new dialog keep showing up on plan changes (#150)
- Loading branch information
1 parent
5a92ee1
commit f650748
Showing
3 changed files
with
63 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:nwt_reading/src/localization/app_localizations_getter.dart'; | ||
import 'package:nwt_reading/src/plans/entities/plans.dart'; | ||
import 'package:nwt_reading/src/plans/presentations/plan_card.dart'; | ||
|
||
class PlansGrid extends ConsumerWidget { | ||
const PlansGrid({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final plans = ref.watch(plansProvider); | ||
|
||
return plans.plans.isEmpty | ||
? Center( | ||
key: const Key('no-plan-yet'), | ||
child: Text(context.loc.plansPageNoPlanYet), | ||
) | ||
: GridView.extent( | ||
childAspectRatio: 1.6, | ||
maxCrossAxisExtent: 600, | ||
padding: const EdgeInsets.all(20), | ||
crossAxisSpacing: 20, | ||
mainAxisSpacing: 20, | ||
restorationId: 'plansView', | ||
children: buildPlansGrid(plans), | ||
); | ||
} | ||
|
||
List<PlanCard> buildPlansGrid(Plans plans) => | ||
plans.plans.map((plan) => PlanCard(plan.id)).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