mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-23 01:29:40 +02:00
Migrated to Material You
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:obtainium/pages/apps.dart';
|
||||
import 'package:obtainium/pages/home.dart';
|
||||
import 'package:obtainium/services/apps_provider.dart';
|
||||
import 'package:obtainium/services/source_service.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:workmanager/workmanager.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
|
||||
void backgroundUpdateCheck() {
|
||||
Workmanager().executeTask((task, inputData) async {
|
||||
@@ -36,6 +37,7 @@ void main() async {
|
||||
await Workmanager().registerPeriodicTask(
|
||||
'update-apps-task', 'backgroundUpdateCheck',
|
||||
frequency: const Duration(minutes: 15),
|
||||
initialDelay: const Duration(minutes: 15),
|
||||
constraints: Constraints(networkType: NetworkType.connected));
|
||||
runApp(MultiProvider(
|
||||
providers: [ChangeNotifierProvider(create: (context) => AppsProvider())],
|
||||
@@ -43,16 +45,35 @@ void main() async {
|
||||
));
|
||||
}
|
||||
|
||||
var defaultThemeColour = const Color(0xFF69F0AE);
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Obtainium',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: const AppsPage());
|
||||
return DynamicColorBuilder(
|
||||
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||
ColorScheme lightColorScheme;
|
||||
ColorScheme darkColorScheme;
|
||||
if (lightDynamic != null && darkDynamic != null) {
|
||||
lightColorScheme = lightDynamic.harmonized();
|
||||
darkColorScheme = darkDynamic.harmonized();
|
||||
} else {
|
||||
lightColorScheme = ColorScheme.fromSeed(seedColor: defaultThemeColour);
|
||||
darkColorScheme = ColorScheme.fromSeed(
|
||||
seedColor: defaultThemeColour, brightness: Brightness.dark);
|
||||
}
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Obtainium',
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: lightColorScheme,
|
||||
fontFamily: 'Metropolis'),
|
||||
darkTheme:
|
||||
ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
|
||||
home: const HomePage());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user