修复保存记分无法返回上一页
This commit is contained in:
@@ -64,9 +64,9 @@ class PointBookHomeScreen extends ConsumerWidget {
|
||||
}
|
||||
|
||||
Future<void> _openRecords(BuildContext context) async {
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(builder: (_) => const PointBookListPage()),
|
||||
);
|
||||
await Navigator.of(
|
||||
context,
|
||||
).push(MaterialPageRoute<void>(builder: (_) => const PointBookListPage()));
|
||||
}
|
||||
|
||||
Future<void> _startScoring(BuildContext context, WidgetRef ref) async {
|
||||
@@ -105,24 +105,19 @@ class PointBookHomeScreen extends ConsumerWidget {
|
||||
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) {
|
||||
await _goToEdit(context, created, replacePrevious: true);
|
||||
await _goToEdit(context, created);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _goToEdit(
|
||||
BuildContext context,
|
||||
PointRecord record, {
|
||||
bool replacePrevious = false,
|
||||
}) async {
|
||||
final route = MaterialPageRoute<void>(
|
||||
builder: (_) => PointBookEditPage(recordId: record.id),
|
||||
Future<void> _goToEdit(BuildContext context, PointRecord record) async {
|
||||
await Navigator.of(context).push(
|
||||
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) {
|
||||
@@ -194,7 +189,10 @@ class _EntitlementBanner 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 onStartScoring;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user