|
|
@ -3,6 +3,7 @@
|
|
|
|
// found in the LICENSE file.
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:testing_app/models/favorites.dart';
|
|
|
|
import 'package:testing_app/models/favorites.dart';
|
|
|
|
import 'package:testing_app/screens/favorites.dart';
|
|
|
|
import 'package:testing_app/screens/favorites.dart';
|
|
|
@ -12,6 +13,23 @@ void main() {
|
|
|
|
runApp(const TestingApp());
|
|
|
|
runApp(const TestingApp());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GoRouter router() {
|
|
|
|
|
|
|
|
return GoRouter(
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: HomePage.routeName,
|
|
|
|
|
|
|
|
builder: (context, state) => const HomePage(),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: FavoritesPage.routeName,
|
|
|
|
|
|
|
|
builder: (context, state) => const FavoritesPage(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class TestingApp extends StatelessWidget {
|
|
|
|
class TestingApp extends StatelessWidget {
|
|
|
|
const TestingApp({super.key});
|
|
|
|
const TestingApp({super.key});
|
|
|
|
|
|
|
|
|
|
|
@ -19,17 +37,13 @@ class TestingApp extends StatelessWidget {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ChangeNotifierProvider<Favorites>(
|
|
|
|
return ChangeNotifierProvider<Favorites>(
|
|
|
|
create: (context) => Favorites(),
|
|
|
|
create: (context) => Favorites(),
|
|
|
|
child: MaterialApp(
|
|
|
|
child: MaterialApp.router(
|
|
|
|
title: 'Testing Sample',
|
|
|
|
title: 'Testing Sample',
|
|
|
|
theme: ThemeData(
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
routes: {
|
|
|
|
routerConfig: router(),
|
|
|
|
HomePage.routeName: (context) => const HomePage(),
|
|
|
|
|
|
|
|
FavoritesPage.routeName: (context) => const FavoritesPage(),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
initialRoute: HomePage.routeName,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|