You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.7 KiB
Dart
86 lines
2.7 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'ui/common_appbar.dart';
|
|
import 'ui/screens/forgot_password_screen.dart';
|
|
import 'ui/screens/home_screen.dart';
|
|
import 'ui/screens/login_screen.dart';
|
|
import 'ui/screens/registration_screen.dart';
|
|
import 'ui/screens/surah_screen.dart';
|
|
import 'ui/screens/tangheem_detail_screen.dart';
|
|
import 'classes/colors.dart';
|
|
import 'ui/screens/tangheem_screen.dart';
|
|
|
|
void main() {
|
|
runApp(Application());
|
|
}
|
|
|
|
class Application extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Tangheem',
|
|
theme: lightTheme(),
|
|
debugShowCheckedModeBanner: false,
|
|
initialRoute: HomeScreen.routeName,
|
|
onGenerateRoute: (settings) {
|
|
var className;
|
|
switch (settings.name) {
|
|
case LoginScreen.routeName:
|
|
className = CommonAppbar(child: LoginScreen());
|
|
break;
|
|
case RegistrationScreen.routeName:
|
|
className = CommonAppbar(child: RegistrationScreen());
|
|
break;
|
|
case ForgotPasswordScreen.routeName:
|
|
className = CommonAppbar(child: ForgotPasswordScreen());
|
|
break;
|
|
case HomeScreen.routeName:
|
|
className = CommonAppbar(showDrawer: true, child: HomeScreen());
|
|
break;
|
|
case TangheemScreen.routeName:
|
|
Map<String, Object> data = settings.arguments;
|
|
className = CommonAppbar(
|
|
child: TangheemScreen(
|
|
surah: data["surahData"],
|
|
tangheemTypeName: data["tangheemTypeName"],
|
|
),
|
|
);
|
|
break;
|
|
case TangheemDetailScreen.routeName:
|
|
className = CommonAppbar(
|
|
child: TangheemDetailScreen(ayatTangheemTypeMappedData: settings.arguments),
|
|
);
|
|
break;
|
|
case SurahScreen.routeName:
|
|
String query = settings.arguments.toString();
|
|
className = CommonAppbar(child: SurahScreen(query: query));
|
|
break;
|
|
}
|
|
return goToNavigation(className);
|
|
},
|
|
);
|
|
}
|
|
|
|
PageRoute goToNavigation(var className) {
|
|
if (Platform.isIOS) {
|
|
return CupertinoPageRoute(builder: (context) => className);
|
|
}
|
|
return MaterialPageRoute(builder: (context) => className);
|
|
}
|
|
|
|
ThemeData lightTheme() {
|
|
return ThemeData(
|
|
fontFamily: 'DroidKufi',
|
|
brightness: Brightness.light,
|
|
backgroundColor: ColorConsts.secondaryWhite,
|
|
primarySwatch: Colors.blue,
|
|
primaryColor: Colors.white,
|
|
primaryColorBrightness: Brightness.light,
|
|
primaryColorLight: Colors.white,
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
);
|
|
}
|
|
}
|