58 lines
1.6 KiB
Dart
58 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:intl/date_symbol_data_file.dart';
|
|
|
|
import 'app/constant.dart';
|
|
import 'app/route.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
SystemChrome.setPreferredOrientations([
|
|
DeviceOrientation.portraitUp,
|
|
DeviceOrientation.portraitUp,
|
|
]).then((value) => runApp(const ProviderScope(child: MyApp())));
|
|
// runApp(const ProviderScope(child: MyApp()));
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Aplikasi Kurir Kedungdoro',
|
|
theme: ThemeData(
|
|
useMaterial3: false,
|
|
primarySwatch: createMaterialColor(const Color(0xFF005AA9)),
|
|
fontFamily: 'OpenSans',
|
|
),
|
|
debugShowCheckedModeBanner: false,
|
|
// initialRoute: loginRoute,
|
|
initialRoute: splashRoute,
|
|
onGenerateRoute: AppRoute.generateRoute,
|
|
);
|
|
}
|
|
}
|
|
|
|
MaterialColor createMaterialColor(Color color) {
|
|
List strengths = <double>[.05];
|
|
Map<int, Color> swatch = {};
|
|
final int r = color.red, g = color.green, b = color.blue;
|
|
|
|
for (int i = 1; i < 10; i++) {
|
|
strengths.add(0.1 * i);
|
|
}
|
|
for (var strength in strengths) {
|
|
final double ds = 0.5 - strength;
|
|
swatch[(strength * 1000).round()] = Color.fromRGBO(
|
|
r + ((ds < 0 ? r : (255 - r)) * ds).round(),
|
|
g + ((ds < 0 ? g : (255 - g)) * ds).round(),
|
|
b + ((ds < 0 ? b : (255 - b)) * ds).round(),
|
|
1,
|
|
);
|
|
}
|
|
return MaterialColor(color.value, swatch);
|
|
}
|