Add temporary navSpike to sanity check routing solutions
This commit is contained in:
parent
2853af8f61
commit
539b79a20e
@ -9,17 +9,23 @@ import 'package:wonders/logic/locale_logic.dart';
|
|||||||
import 'package:wonders/logic/timeline_logic.dart';
|
import 'package:wonders/logic/timeline_logic.dart';
|
||||||
import 'package:wonders/logic/unsplash_logic.dart';
|
import 'package:wonders/logic/unsplash_logic.dart';
|
||||||
import 'package:wonders/logic/wonders_logic.dart';
|
import 'package:wonders/logic/wonders_logic.dart';
|
||||||
|
import 'package:wonders/nav_spike.dart';
|
||||||
import 'package:wonders/ui/common/app_shortcuts.dart';
|
import 'package:wonders/ui/common/app_shortcuts.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
||||||
// Keep native splash screen up until app is finished bootstrapping
|
// Keep native splash screen up until app is finished bootstrapping
|
||||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||||
|
GoRouter.optionURLReflectsImperativeAPIs = true;
|
||||||
|
|
||||||
// Start app
|
// Start app
|
||||||
registerSingletons();
|
registerSingletons();
|
||||||
runApp(WondersApp());
|
|
||||||
await appLogic.bootstrap();
|
// Spike:
|
||||||
|
runApp(NavSpikeApp());
|
||||||
|
|
||||||
|
//runApp(WondersApp());
|
||||||
|
//await appLogic.bootstrap();
|
||||||
|
|
||||||
// Remove splash screen when bootstrap is complete
|
// Remove splash screen when bootstrap is complete
|
||||||
FlutterNativeSplash.remove();
|
FlutterNativeSplash.remove();
|
||||||
|
54
lib/nav_spike.dart
Normal file
54
lib/nav_spike.dart
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import 'package:advanced_navigator/advanced_navigator.dart';
|
||||||
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
|
final GoRouter _router = GoRouter(
|
||||||
|
initialLocation: '/a',
|
||||||
|
routes: <RouteBase>[
|
||||||
|
GoRoute(
|
||||||
|
path: '/a',
|
||||||
|
builder: (BuildContext context, GoRouterState state) => Screen(name: 'A'),
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/b',
|
||||||
|
builder: (BuildContext context, GoRouterState state) => Screen(name: 'B'),
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: '/c',
|
||||||
|
builder: (BuildContext context, GoRouterState state) => Screen(name: 'C'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
/// The main app.
|
||||||
|
class NavSpikeApp extends StatelessWidget {
|
||||||
|
const NavSpikeApp({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => MaterialApp.router(routerConfig: _router);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The home screen
|
||||||
|
class Screen extends StatelessWidget {
|
||||||
|
const Screen({super.key, required this.name});
|
||||||
|
final String name;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
void navigate(String name) => context.push(name);
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text(name)),
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(name, style: TextStyle(fontSize: 48)),
|
||||||
|
ElevatedButton(onPressed: () => navigate('/a'), child: const Text('A')),
|
||||||
|
ElevatedButton(onPressed: () => navigate('/b'), child: const Text('B')),
|
||||||
|
ElevatedButton(onPressed: () => navigate('/c'), child: const Text('C')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user