修复保存记分无法返回上一页
This commit is contained in:
@@ -64,9 +64,9 @@ class PointBookHomeScreen extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _openRecords(BuildContext context) async {
|
Future<void> _openRecords(BuildContext context) async {
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(
|
||||||
MaterialPageRoute<void>(builder: (_) => const PointBookListPage()),
|
context,
|
||||||
);
|
).push(MaterialPageRoute<void>(builder: (_) => const PointBookListPage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _startScoring(BuildContext context, WidgetRef ref) async {
|
Future<void> _startScoring(BuildContext context, WidgetRef ref) async {
|
||||||
@@ -105,24 +105,19 @@ class PointBookHomeScreen extends ConsumerWidget {
|
|||||||
builder: (_) => const PointBookCreatePage(),
|
builder: (_) => const PointBookCreatePage(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
// Create already popped itself before returning, so the stack is [Home]
|
||||||
|
// here. A plain push yields [Home, Edit] and back/popUntil lands on Home.
|
||||||
if (created != null && context.mounted) {
|
if (created != null && context.mounted) {
|
||||||
await _goToEdit(context, created, replacePrevious: true);
|
await _goToEdit(context, created);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _goToEdit(
|
Future<void> _goToEdit(BuildContext context, PointRecord record) async {
|
||||||
BuildContext context,
|
await Navigator.of(context).push(
|
||||||
PointRecord record, {
|
MaterialPageRoute<void>(
|
||||||
bool replacePrevious = false,
|
builder: (_) => PointBookEditPage(recordId: record.id),
|
||||||
}) async {
|
),
|
||||||
final route = MaterialPageRoute<void>(
|
|
||||||
builder: (_) => PointBookEditPage(recordId: record.id),
|
|
||||||
);
|
);
|
||||||
if (replacePrevious) {
|
|
||||||
Navigator.of(context).pushReplacement(route);
|
|
||||||
} else {
|
|
||||||
await Navigator.of(context).push(route);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> _showDraftConfirm(BuildContext context) {
|
Future<bool?> _showDraftConfirm(BuildContext context) {
|
||||||
@@ -194,7 +189,10 @@ class _EntitlementBanner extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _EntryButtons extends StatelessWidget {
|
class _EntryButtons extends StatelessWidget {
|
||||||
const _EntryButtons({required this.onOpenRecords, required this.onStartScoring});
|
const _EntryButtons({
|
||||||
|
required this.onOpenRecords,
|
||||||
|
required this.onStartScoring,
|
||||||
|
});
|
||||||
final VoidCallback onOpenRecords;
|
final VoidCallback onOpenRecords;
|
||||||
final VoidCallback onStartScoring;
|
final VoidCallback onStartScoring;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user