251 lines
7.5 KiB
Dart
251 lines
7.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'common/utils.dart';
|
|
import 'data/repository/_dao.dart';
|
|
//import 'data/api/_api.dart';
|
|
import 'data/models/_models.dart';
|
|
import 'ui/views/_views.dart';
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiProvider(
|
|
providers: [
|
|
ChangeNotifierProvider(create: (context) => AppController(context)),
|
|
// more providers here
|
|
],
|
|
child: MaterialApp.router(
|
|
title: 'Demo',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
brightness: Brightness.light,
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
),
|
|
routerConfig: GoRouter(
|
|
initialLocation: '/aboutus',
|
|
routes: [
|
|
GoRoute(
|
|
path: '/aboutus',
|
|
builder: (context, state) {
|
|
return AboutUsView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/audioarticle_60rn',
|
|
builder: (context, state) {
|
|
return AudioArticle_60rnView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/bookmark_2rub',
|
|
builder: (context, state) {
|
|
return Bookmark_2rubView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/category_e0b3',
|
|
builder: (context, state) {
|
|
return Category_e0b3View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/changepassword_5ugn',
|
|
builder: (context, state) {
|
|
return ChangePassword_5ugnView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/chat_n9xm',
|
|
builder: (context, state) {
|
|
return Chat_n9xmView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/contactus_inkn',
|
|
builder: (context, state) {
|
|
return ContactUs_inknView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/dashboard_jvxm',
|
|
builder: (context, state) {
|
|
return Dashboard_jvxmView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/datanotfound_f1qf',
|
|
builder: (context, state) {
|
|
return DataNotFound_f1qfView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/detail_dm5h',
|
|
builder: (context, state) {
|
|
return Detail_dm5hView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/discover_au68',
|
|
builder: (context, state) {
|
|
return Discover_au68View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/emptypinnotes_1l1v',
|
|
builder: (context, state) {
|
|
return EmptyPinNotes_1l1vView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/following_s3l5',
|
|
builder: (context, state) {
|
|
return Following_s3l5View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/forgotpassword_xt11',
|
|
builder: (context, state) {
|
|
return ForgotPassword_xt11View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/grid_kcdz',
|
|
builder: (context, state) {
|
|
return Grid_kcdzView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/home_cigx',
|
|
builder: (context, state) {
|
|
return Home_cigxView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/labels_sxue',
|
|
builder: (context, state) {
|
|
return Labels_sxueView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/list_1eal',
|
|
builder: (context, state) {
|
|
return List_1ealView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/login_qayv',
|
|
builder: (context, state) {
|
|
return Login_qayvView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/membership_z9ze',
|
|
builder: (context, state) {
|
|
return Membership_z9zeView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/myaccount_tyvz',
|
|
builder: (context, state) {
|
|
return MyAccount_tyvzView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/newsdetails_t6nw',
|
|
builder: (context, state) {
|
|
return NewsDetails_t6nwView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/nodatafound_shk8',
|
|
builder: (context, state) {
|
|
return NoDataFound_shk8View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/notificationsetting_bycd',
|
|
builder: (context, state) {
|
|
return NotificationSetting_bycdView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/pinnotelist_qn8a',
|
|
builder: (context, state) {
|
|
return PinNoteList_qn8aView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/profile_pzn0',
|
|
builder: (context, state) {
|
|
return Profile_pzn0View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/register_obmz',
|
|
builder: (context, state) {
|
|
return Register_obmzView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/review_47su',
|
|
builder: (context, state) {
|
|
return Review_47suView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/setting_pano',
|
|
builder: (context, state) {
|
|
return Setting_panoView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/splash_p2g8',
|
|
builder: (context, state) {
|
|
return Splash_p2g8View(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/verification_nhug',
|
|
builder: (context, state) {
|
|
return Verification_nhugView(extra: state.extra);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/welcome_g72w',
|
|
builder: (context, state) {
|
|
return Welcome_g72wView(extra: state.extra);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class AppController with ChangeNotifier {
|
|
static AppController? _instance;
|
|
final BuildContext context;
|
|
|
|
// singleton instance
|
|
factory AppController(BuildContext context) =>
|
|
_instance ??= AppController._internal(context);
|
|
|
|
AppController._internal(this.context) {
|
|
loadData();
|
|
}
|
|
|
|
Future<void> loadData() async {
|
|
await fillWithMockData();
|
|
}
|
|
|
|
void back() {
|
|
Navigator.maybePop(context);
|
|
}
|
|
|
|
final sampleDao = SampleDao();
|
|
}
|