Skip to content

Commit

Permalink
feat: added dynamic colors (Android 13+)
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerOrnstein committed Dec 6, 2023
1 parent 0bb2dd6 commit 562222b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 42 deletions.
49 changes: 30 additions & 19 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:navis/home/home.dart';
Expand Down Expand Up @@ -136,26 +137,36 @@ class _NavisAppState extends State<NavisApp> with WidgetsBindingObserver {
_ => const Locale('en')
};

return MaterialApp(
title: 'Navis',
color: Colors.grey[900],
themeMode: themeMode,
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
home: const HomeView(),
builder: _builder,
navigatorObservers: [SentryNavigatorObserver()],
routes: <String, WidgetBuilder>{
EventInformation.route: (_) => const EventInformation(),
SettingsPage.route: (_) => const SettingsPage(),
NightwavesPage.route: (_) => const NightwavesPage(),
BountiesPage.route: (_) => const BountiesPage(),
BaroInventory.route: (_) => const BaroInventory(),
return DynamicColorBuilder(
builder: (lightDynamic, darkDynamic) {
return MaterialApp(
title: 'Navis',
color: Colors.grey[900],
themeMode: themeMode,
theme: ThemeData(
useMaterial3: true,
colorScheme: lightDynamic ?? lightColorScheme,
),
darkTheme: ThemeData(
useMaterial3: true,
colorScheme: darkDynamic ?? darkColorScheme,
),
home: const HomeView(),
builder: _builder,
navigatorObservers: [SentryNavigatorObserver()],
routes: <String, WidgetBuilder>{
EventInformation.route: (_) => const EventInformation(),
SettingsPage.route: (_) => const SettingsPage(),
NightwavesPage.route: (_) => const NightwavesPage(),
BountiesPage.route: (_) => const BountiesPage(),
BaroInventory.route: (_) => const BaroInventory(),
},
supportedLocales: NavisLocalizations.supportedLocales,
locale: language,
localizationsDelegates: NavisLocalizations.localizationsDelegates,
localeResolutionCallback: localeResolutionCallback,
);
},
supportedLocales: NavisLocalizations.supportedLocales,
locale: language,
localizationsDelegates: NavisLocalizations.localizationsDelegates,
localeResolutionCallback: localeResolutionCallback,
);
}

Expand Down
31 changes: 8 additions & 23 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.1"
dynamic_color:
dependency: "direct main"
description:
name: dynamic_color
sha256: "8b8bd1d798bd393e11eddeaa8ae95b12ff028bf7d5998fc5d003488cd5f4ce2f"
url: "https://pub.dev"
source: hosted
version: "1.6.8"
equatable:
dependency: "direct main"
description:
Expand Down Expand Up @@ -501,22 +509,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
market_client:
dependency: "direct main"
description:
path: "."
ref: "v4.0.2"
resolved-ref: "57e94ab37220eea8b485a702daff809304b5eae2"
url: "https://github.com/SlayerOrnstein/market_client.git"
source: git
version: "4.0.2"
market_repository:
dependency: "direct main"
description:
path: "packages/market_repository"
relative: true
source: path
version: "1.0.0+1"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -1064,13 +1056,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.1"
user_settings:
dependency: transitive
description:
path: "packages/user_settings"
relative: true
source: path
version: "1.0.0+1"
uuid:
dependency: "direct overridden"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
bloc: ^8.1.2
cached_network_image: ^3.3.0
collection: ^1.17.2
dynamic_color: ^1.6.8
equatable: ^2.0.5
feedback_sentry: ^3.0.0
firebase_core: ^2.22.0
Expand Down

0 comments on commit 562222b

Please sign in to comment.