tsacdop-podcast-app-android/lib/main.dart

84 lines
2.9 KiB
Dart
Raw Normal View History

2020-02-09 13:29:09 +01:00
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
2020-02-09 13:29:09 +01:00
import 'package:flutter_downloader/flutter_downloader.dart';
2020-03-01 13:17:06 +01:00
import 'package:tsacdop/class/podcast_group.dart';
2020-02-11 14:48:11 +01:00
import 'package:tsacdop/home/appbar/addpodcast.dart';
import 'package:tsacdop/class/audiostate.dart';
import 'package:tsacdop/class/importompl.dart';
import 'package:tsacdop/class/settingstate.dart';
2020-03-31 18:36:20 +02:00
import 'package:tsacdop/class/download_state.dart';
2020-02-09 13:29:09 +01:00
2020-04-06 14:18:08 +02:00
import 'intro_slider/app_intro.dart';
final SettingState themeSetting = SettingState();
2020-03-01 13:17:06 +01:00
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await themeSetting.initData();
2020-03-31 18:36:20 +02:00
2020-02-09 13:29:09 +01:00
runApp(
MultiProvider(
providers: [
2020-03-01 13:17:06 +01:00
ChangeNotifierProvider(create: (_) => themeSetting),
ChangeNotifierProvider(create: (_) => AudioPlayerNotifier()),
2020-03-01 13:17:06 +01:00
ChangeNotifierProvider(create: (_) => GroupList()),
ChangeNotifierProvider(create: (_) => ImportOmpl()),
2020-03-31 18:36:20 +02:00
ChangeNotifierProvider(create: (_) => DownloadState(),
)
2020-02-09 13:29:09 +01:00
],
child: MyApp(),
),
);
2020-03-31 18:36:20 +02:00
await FlutterDownloader.initialize();
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
2020-03-01 13:17:06 +01:00
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
}
2020-02-09 13:29:09 +01:00
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
2020-03-01 13:17:06 +01:00
return Consumer<SettingState>(
builder: (_, setting, __) {
return MaterialApp(
themeMode: setting.theme,
debugShowCheckedModeBanner: false,
title: 'Tsacdop',
theme: ThemeData(
accentColorBrightness: Brightness.dark,
primaryColor: Colors.grey[100],
accentColor: setting.accentSetColor,
primaryColorLight: Colors.white,
primaryColorDark: Colors.grey[300],
dialogBackgroundColor: Colors.white,
backgroundColor: Colors.grey[100],
appBarTheme: AppBarTheme(
color: Colors.grey[100],
elevation: 0,
),
textTheme: TextTheme(
bodyText2:
TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal),
),
tabBarTheme: TabBarTheme(
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[400],
),
),
darkTheme: ThemeData.dark().copyWith(
accentColor: setting.accentSetColor,
2020-03-22 18:03:53 +01:00
primaryColorDark: Colors.grey[800],
2020-03-31 18:36:20 +02:00
// scaffoldBackgroundColor: Colors.black87,
appBarTheme: AppBarTheme(elevation: 0),
2020-03-01 13:17:06 +01:00
),
2020-04-06 14:18:08 +02:00
home: setting.showIntro ? SlideIntro(goto: Goto.home) : MyHomePage(),
2020-03-01 13:17:06 +01:00
);
},
2020-02-09 13:29:09 +01:00
);
}
}