mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-09-07 19:46:06 +00:00
Compare commits
2 commits
f290a71b94
...
fc120053f2
Author | SHA1 | Date | |
---|---|---|---|
|
fc120053f2 | ||
|
5a641be96f |
10 changed files with 431 additions and 46 deletions
|
@ -22,7 +22,7 @@ Run `flutter doctor` and fix everything it complains before proceeding
|
|||
|
||||
- Copy `env.sh.example` and set it up for your machine
|
||||
- Ensure you have run `gomobile init`
|
||||
- In Android Studio, make sure you have the current ndk installed by going to Tools -> SDK Manager, go to the SDK Tools tab, check the `Show package details` box, expand the NDK section and select `26.1.10909125` version.
|
||||
- In Android Studio, make sure you have the current ndk installed by going to Tools -> SDK Manager, go to the SDK Tools tab, check the `Show package details` box, expand the NDK section and select `27.0.12077973` version.
|
||||
- Ensure you have downloaded an ndk via android studio, this is likely not the default one and you need to check the
|
||||
`Show package details` box to select the correct version. The correct version comes from the error when you try and compile
|
||||
- Make sure you have `gem` installed with `sudo gem install`
|
||||
|
|
|
@ -28,8 +28,8 @@ android {
|
|||
|
||||
compileSdkVersion 34
|
||||
|
||||
// default ndk version for AGP 8.5: https://developer.android.com/build/releases/past-releases/agp-8-5-0-release-notes
|
||||
ndkVersion "26.1.10909125"
|
||||
// default ndk version for AGP 8.7: https://developer.android.com/build/releases/past-releases/agp-8-7-0-release-notes
|
||||
ndkVersion "27.0.12077973"
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
|
|
|
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||
|
|
|
@ -19,7 +19,7 @@ pluginManagement {
|
|||
plugins {
|
||||
id "org.gradle.toolchains.foojay-resolver-convention" version "0.8.0"
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version '8.6.1' apply false
|
||||
id "com.android.application" version '8.8.0' apply false
|
||||
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ class DangerButton extends StatelessWidget {
|
|||
return FilledButton(
|
||||
onPressed: onPressed,
|
||||
child: child,
|
||||
style: FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.error));
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
foregroundColor: Theme.of(context).colorScheme.onError));
|
||||
} else {
|
||||
// Workaround for https://github.com/flutter/flutter/issues/161590
|
||||
final themeData = CupertinoTheme.of(context);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart' show CupertinoThemeData, DefaultCupertinoLocalizations, CupertinoColors;
|
||||
import 'package:flutter/material.dart'
|
||||
show BottomSheetThemeData, ColorScheme, Colors, DefaultMaterialLocalizations, ThemeData, ThemeMode;
|
||||
import 'package:flutter/cupertino.dart' show CupertinoThemeData, DefaultCupertinoLocalizations;
|
||||
import 'package:flutter/material.dart' show DefaultMaterialLocalizations, TextTheme, ThemeMode;
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
@ -11,6 +10,8 @@ import 'package:mobile_nebula/screens/MainScreen.dart';
|
|||
import 'package:mobile_nebula/screens/EnrollmentScreen.dart';
|
||||
import 'package:mobile_nebula/services/settings.dart';
|
||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||
import 'package:mobile_nebula/services/theme.dart';
|
||||
import 'package:mobile_nebula/services/utils.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
|
@ -85,36 +86,8 @@ class _AppState extends State<App> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData lightTheme = ThemeData(
|
||||
useMaterial3: false,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
brightness: Brightness.light,
|
||||
primarySwatch: Colors.blueGrey,
|
||||
errorColor: CupertinoColors.systemRed.resolveFrom(context),
|
||||
),
|
||||
primaryColor: Colors.blueGrey[900],
|
||||
fontFamily: 'PublicSans',
|
||||
//scaffoldBackgroundColor: Colors.grey[100],
|
||||
scaffoldBackgroundColor: Colors.white,
|
||||
bottomSheetTheme: BottomSheetThemeData(
|
||||
backgroundColor: Colors.blueGrey[50],
|
||||
),
|
||||
);
|
||||
|
||||
final ThemeData darkTheme = ThemeData(
|
||||
useMaterial3: false,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
brightness: Brightness.dark,
|
||||
primarySwatch: Colors.grey,
|
||||
errorColor: CupertinoColors.systemRed.resolveFrom(context),
|
||||
),
|
||||
primaryColor: Colors.grey[900],
|
||||
fontFamily: 'PublicSans',
|
||||
scaffoldBackgroundColor: Colors.grey[800],
|
||||
bottomSheetTheme: BottomSheetThemeData(
|
||||
backgroundColor: Colors.grey[850],
|
||||
),
|
||||
);
|
||||
TextTheme textTheme = Utils.createTextTheme(context, "Public Sans", "Public Sans");
|
||||
MaterialTheme theme = MaterialTheme(textTheme);
|
||||
|
||||
return PlatformProvider(
|
||||
settings: PlatformSettingsData(iosUsesMaterialWidgets: true),
|
||||
|
@ -129,7 +102,7 @@ class _AppState extends State<App> {
|
|||
material: (_, __) {
|
||||
return new MaterialAppData(
|
||||
themeMode: brightness == Brightness.light ? ThemeMode.light : ThemeMode.dark,
|
||||
theme: brightness == Brightness.light ? lightTheme : darkTheme,
|
||||
theme: brightness == Brightness.light ? theme.light() : theme.dark(),
|
||||
);
|
||||
},
|
||||
cupertino: (_, __) => CupertinoAppData(
|
||||
|
|
389
lib/services/theme.dart
Normal file
389
lib/services/theme.dart
Normal file
|
@ -0,0 +1,389 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
// Originally generated by https://material-foundation.github.io/material-theme-builder/
|
||||
// from a source color of #5D23DD
|
||||
|
||||
class MaterialTheme {
|
||||
final TextTheme textTheme;
|
||||
|
||||
const MaterialTheme(this.textTheme);
|
||||
|
||||
static ColorScheme lightScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.light,
|
||||
primary: Color(4284700303),
|
||||
surfaceTint: Color(4284700303),
|
||||
onPrimary: Color(4294967295),
|
||||
primaryContainer: Color(4293451519),
|
||||
onPrimaryContainer: Color(4283121270),
|
||||
secondary: Color(4284570481),
|
||||
onSecondary: Color(4294967295),
|
||||
secondaryContainer: Color(4293385976),
|
||||
onSecondaryContainer: Color(4282991704),
|
||||
tertiary: Color(4286403169),
|
||||
onTertiary: Color(4294967295),
|
||||
tertiaryContainer: Color(4294957540),
|
||||
onTertiaryContainer: Color(4284693322),
|
||||
error: Color(4290386458),
|
||||
onError: Color(4294967295),
|
||||
errorContainer: Color(4294957782),
|
||||
onErrorContainer: Color(4287823882),
|
||||
surface: Color(4294834175),
|
||||
onSurface: Color(4280032032),
|
||||
onSurfaceVariant: Color(4282926414),
|
||||
outline: Color(4286150015),
|
||||
outlineVariant: Color(4291478735),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4281478965),
|
||||
inversePrimary: Color(4291673599),
|
||||
primaryFixed: Color(4293451519),
|
||||
onPrimaryFixed: Color(4280225864),
|
||||
primaryFixedDim: Color(4291673599),
|
||||
onPrimaryFixedVariant: Color(4283121270),
|
||||
secondaryFixed: Color(4293385976),
|
||||
onSecondaryFixed: Color(4280097067),
|
||||
secondaryFixedDim: Color(4291544028),
|
||||
onSecondaryFixedVariant: Color(4282991704),
|
||||
tertiaryFixed: Color(4294957540),
|
||||
onTertiaryFixed: Color(4281405726),
|
||||
tertiaryFixedDim: Color(4293834953),
|
||||
onTertiaryFixedVariant: Color(4284693322),
|
||||
surfaceDim: Color(4292729056),
|
||||
surfaceBright: Color(4294834175),
|
||||
surfaceContainerLowest: Color(4294967295),
|
||||
surfaceContainerLow: Color(4294439674),
|
||||
surfaceContainer: Color(4294110452),
|
||||
surfaceContainerHigh: Color(4293715694),
|
||||
surfaceContainerHighest: Color(4293321193),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData light() {
|
||||
return theme(lightScheme());
|
||||
}
|
||||
|
||||
static ColorScheme lightMediumContrastScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.light,
|
||||
primary: Color(4282002788),
|
||||
surfaceTint: Color(4284700303),
|
||||
onPrimary: Color(4294967295),
|
||||
primaryContainer: Color(4285686943),
|
||||
onPrimaryContainer: Color(4294967295),
|
||||
secondary: Color(4281873223),
|
||||
onSecondary: Color(4294967295),
|
||||
secondaryContainer: Color(4285557376),
|
||||
onSecondaryContainer: Color(4294967295),
|
||||
tertiary: Color(4283444025),
|
||||
onTertiary: Color(4294967295),
|
||||
tertiaryContainer: Color(4287455344),
|
||||
onTertiaryContainer: Color(4294967295),
|
||||
error: Color(4285792262),
|
||||
onError: Color(4294967295),
|
||||
errorContainer: Color(4291767335),
|
||||
onErrorContainer: Color(4294967295),
|
||||
surface: Color(4294834175),
|
||||
onSurface: Color(4279373846),
|
||||
onSurfaceVariant: Color(4281873725),
|
||||
outline: Color(4283715930),
|
||||
outlineVariant: Color(4285492085),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4281478965),
|
||||
inversePrimary: Color(4291673599),
|
||||
primaryFixed: Color(4285686943),
|
||||
onPrimaryFixed: Color(4294967295),
|
||||
primaryFixedDim: Color(4284042373),
|
||||
onPrimaryFixedVariant: Color(4294967295),
|
||||
secondaryFixed: Color(4285557376),
|
||||
onSecondaryFixed: Color(4294967295),
|
||||
secondaryFixedDim: Color(4283912807),
|
||||
onSecondaryFixedVariant: Color(4294967295),
|
||||
tertiaryFixed: Color(4287455344),
|
||||
onTertiaryFixed: Color(4294967295),
|
||||
tertiaryFixedDim: Color(4285679960),
|
||||
onTertiaryFixedVariant: Color(4294967295),
|
||||
surfaceDim: Color(4291478989),
|
||||
surfaceBright: Color(4294834175),
|
||||
surfaceContainerLowest: Color(4294967295),
|
||||
surfaceContainerLow: Color(4294439674),
|
||||
surfaceContainer: Color(4293715694),
|
||||
surfaceContainerHigh: Color(4292926435),
|
||||
surfaceContainerHighest: Color(4292202712),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData lightMediumContrast() {
|
||||
return theme(lightMediumContrastScheme());
|
||||
}
|
||||
|
||||
static ColorScheme lightHighContrastScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.light,
|
||||
primary: Color(4281344857),
|
||||
surfaceTint: Color(4284700303),
|
||||
onPrimary: Color(4294967295),
|
||||
primaryContainer: Color(4283252856),
|
||||
onPrimaryContainer: Color(4294967295),
|
||||
secondary: Color(4281215292),
|
||||
onSecondary: Color(4294967295),
|
||||
secondaryContainer: Color(4283123291),
|
||||
onSecondaryContainer: Color(4294967295),
|
||||
tertiary: Color(4282655023),
|
||||
onTertiary: Color(4294967295),
|
||||
tertiaryContainer: Color(4284824908),
|
||||
onTertiaryContainer: Color(4294967295),
|
||||
error: Color(4284481540),
|
||||
onError: Color(4294967295),
|
||||
errorContainer: Color(4288151562),
|
||||
onErrorContainer: Color(4294967295),
|
||||
surface: Color(4294834175),
|
||||
onSurface: Color(4278190080),
|
||||
onSurfaceVariant: Color(4278190080),
|
||||
outline: Color(4281150259),
|
||||
outlineVariant: Color(4283123793),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4281478965),
|
||||
inversePrimary: Color(4291673599),
|
||||
primaryFixed: Color(4283252856),
|
||||
onPrimaryFixed: Color(4294967295),
|
||||
primaryFixedDim: Color(4281739616),
|
||||
onPrimaryFixedVariant: Color(4294967295),
|
||||
secondaryFixed: Color(4283123291),
|
||||
onSecondaryFixed: Color(4294967295),
|
||||
secondaryFixedDim: Color(4281675843),
|
||||
onSecondaryFixedVariant: Color(4294967295),
|
||||
tertiaryFixed: Color(4284824908),
|
||||
onTertiaryFixed: Color(4294967295),
|
||||
tertiaryFixedDim: Color(4283180853),
|
||||
onTertiaryFixedVariant: Color(4294967295),
|
||||
surfaceDim: Color(4290557887),
|
||||
surfaceBright: Color(4294834175),
|
||||
surfaceContainerLowest: Color(4294967295),
|
||||
surfaceContainerLow: Color(4294242295),
|
||||
surfaceContainer: Color(4293321193),
|
||||
surfaceContainerHigh: Color(4292400090),
|
||||
surfaceContainerHighest: Color(4291478989),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData lightHighContrast() {
|
||||
return theme(lightHighContrastScheme());
|
||||
}
|
||||
|
||||
static ColorScheme darkScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
primary: Color(4291673599),
|
||||
surfaceTint: Color(4291673599),
|
||||
onPrimary: Color(4281608030),
|
||||
primaryContainer: Color(4283121270),
|
||||
onPrimaryContainer: Color(4293451519),
|
||||
secondary: Color(4291544028),
|
||||
onSecondary: Color(4281478721),
|
||||
secondaryContainer: Color(4282991704),
|
||||
onSecondaryContainer: Color(4293385976),
|
||||
tertiary: Color(4293834953),
|
||||
onTertiary: Color(4282983731),
|
||||
tertiaryContainer: Color(4284693322),
|
||||
onTertiaryContainer: Color(4294957540),
|
||||
error: Color(4294948011),
|
||||
onError: Color(4285071365),
|
||||
errorContainer: Color(4287823882),
|
||||
onErrorContainer: Color(4294957782),
|
||||
surface: Color(4279505688),
|
||||
onSurface: Color(4293321193),
|
||||
onSurfaceVariant: Color(4291478735),
|
||||
outline: Color(4287860633),
|
||||
outlineVariant: Color(4282926414),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4293321193),
|
||||
inversePrimary: Color(4284700303),
|
||||
primaryFixed: Color(4293451519),
|
||||
onPrimaryFixed: Color(4280225864),
|
||||
primaryFixedDim: Color(4291673599),
|
||||
onPrimaryFixedVariant: Color(4283121270),
|
||||
secondaryFixed: Color(4293385976),
|
||||
onSecondaryFixed: Color(4280097067),
|
||||
secondaryFixedDim: Color(4291544028),
|
||||
onSecondaryFixedVariant: Color(4282991704),
|
||||
tertiaryFixed: Color(4294957540),
|
||||
onTertiaryFixed: Color(4281405726),
|
||||
tertiaryFixedDim: Color(4293834953),
|
||||
onTertiaryFixedVariant: Color(4284693322),
|
||||
surfaceDim: Color(4279505688),
|
||||
surfaceBright: Color(4282005566),
|
||||
surfaceContainerLowest: Color(4279176467),
|
||||
surfaceContainerLow: Color(4280032032),
|
||||
surfaceContainer: Color(4280295204),
|
||||
surfaceContainerHigh: Color(4281018671),
|
||||
surfaceContainerHighest: Color(4281742394),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData dark() {
|
||||
return theme(darkScheme());
|
||||
}
|
||||
|
||||
static ColorScheme darkMediumContrastScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
primary: Color(4293056255),
|
||||
surfaceTint: Color(4291673599),
|
||||
onPrimary: Color(4280884306),
|
||||
primaryContainer: Color(4288055493),
|
||||
onPrimaryContainer: Color(4278190080),
|
||||
secondary: Color(4292991218),
|
||||
onSecondary: Color(4280754998),
|
||||
secondaryContainer: Color(4287925669),
|
||||
onSecondaryContainer: Color(4278190080),
|
||||
tertiary: Color(4294955230),
|
||||
onTertiary: Color(4282194472),
|
||||
tertiaryContainer: Color(4290020244),
|
||||
onTertiaryContainer: Color(4278190080),
|
||||
error: Color(4294955724),
|
||||
onError: Color(4283695107),
|
||||
errorContainer: Color(4294923337),
|
||||
onErrorContainer: Color(4278190080),
|
||||
surface: Color(4279505688),
|
||||
onSurface: Color(4294967295),
|
||||
onSurfaceVariant: Color(4292926181),
|
||||
outline: Color(4290097339),
|
||||
outlineVariant: Color(4287860377),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4293321193),
|
||||
inversePrimary: Color(4283187063),
|
||||
primaryFixed: Color(4293451519),
|
||||
onPrimaryFixed: Color(4279501629),
|
||||
primaryFixedDim: Color(4291673599),
|
||||
onPrimaryFixedVariant: Color(4282002788),
|
||||
secondaryFixed: Color(4293385976),
|
||||
onSecondaryFixed: Color(4279438880),
|
||||
secondaryFixedDim: Color(4291544028),
|
||||
onSecondaryFixedVariant: Color(4281873223),
|
||||
tertiaryFixed: Color(4294957540),
|
||||
onTertiaryFixed: Color(4280550932),
|
||||
tertiaryFixedDim: Color(4293834953),
|
||||
onTertiaryFixedVariant: Color(4283444025),
|
||||
surfaceDim: Color(4279505688),
|
||||
surfaceBright: Color(4282794826),
|
||||
surfaceContainerLowest: Color(4278716172),
|
||||
surfaceContainerLow: Color(4280163618),
|
||||
surfaceContainer: Color(4280887085),
|
||||
surfaceContainerHigh: Color(4281610808),
|
||||
surfaceContainerHighest: Color(4282334531),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData darkMediumContrast() {
|
||||
return theme(darkMediumContrastScheme());
|
||||
}
|
||||
|
||||
static ColorScheme darkHighContrastScheme() {
|
||||
return const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
primary: Color(4294241791),
|
||||
surfaceTint: Color(4291673599),
|
||||
onPrimary: Color(4278190080),
|
||||
primaryContainer: Color(4291410427),
|
||||
onPrimaryContainer: Color(4279107636),
|
||||
secondary: Color(4294241791),
|
||||
onSecondary: Color(4278190080),
|
||||
secondaryContainer: Color(4291280856),
|
||||
onSecondaryContainer: Color(4279044122),
|
||||
tertiary: Color(4294962160),
|
||||
onTertiary: Color(4278190080),
|
||||
tertiaryContainer: Color(4293571782),
|
||||
onTertiaryContainer: Color(4280091150),
|
||||
error: Color(4294962409),
|
||||
onError: Color(4278190080),
|
||||
errorContainer: Color(4294946468),
|
||||
onErrorContainer: Color(4280418305),
|
||||
surface: Color(4279505688),
|
||||
onSurface: Color(4294967295),
|
||||
onSurfaceVariant: Color(4294967295),
|
||||
outline: Color(4294242041),
|
||||
outlineVariant: Color(4291215563),
|
||||
shadow: Color(4278190080),
|
||||
scrim: Color(4278190080),
|
||||
inverseSurface: Color(4293321193),
|
||||
inversePrimary: Color(4283187063),
|
||||
primaryFixed: Color(4293451519),
|
||||
onPrimaryFixed: Color(4278190080),
|
||||
primaryFixedDim: Color(4291673599),
|
||||
onPrimaryFixedVariant: Color(4279501629),
|
||||
secondaryFixed: Color(4293385976),
|
||||
onSecondaryFixed: Color(4278190080),
|
||||
secondaryFixedDim: Color(4291544028),
|
||||
onSecondaryFixedVariant: Color(4279438880),
|
||||
tertiaryFixed: Color(4294957540),
|
||||
onTertiaryFixed: Color(4278190080),
|
||||
tertiaryFixedDim: Color(4293834953),
|
||||
onTertiaryFixedVariant: Color(4280550932),
|
||||
surfaceDim: Color(4279505688),
|
||||
surfaceBright: Color(4283584341),
|
||||
surfaceContainerLowest: Color(4278190080),
|
||||
surfaceContainerLow: Color(4280295204),
|
||||
surfaceContainer: Color(4281478965),
|
||||
surfaceContainerHigh: Color(4282202689),
|
||||
surfaceContainerHighest: Color(4282926668),
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData darkHighContrast() {
|
||||
return theme(darkHighContrastScheme());
|
||||
}
|
||||
|
||||
ThemeData theme(ColorScheme colorScheme) => ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: colorScheme.brightness,
|
||||
colorScheme: colorScheme,
|
||||
textTheme: textTheme.apply(
|
||||
bodyColor: colorScheme.onSurface,
|
||||
displayColor: colorScheme.onSurface,
|
||||
),
|
||||
scaffoldBackgroundColor: colorScheme.background,
|
||||
canvasColor: colorScheme.surface,
|
||||
);
|
||||
|
||||
List<ExtendedColor> get extendedColors => [];
|
||||
}
|
||||
|
||||
class ExtendedColor {
|
||||
final Color seed, value;
|
||||
final ColorFamily light;
|
||||
final ColorFamily lightHighContrast;
|
||||
final ColorFamily lightMediumContrast;
|
||||
final ColorFamily dark;
|
||||
final ColorFamily darkHighContrast;
|
||||
final ColorFamily darkMediumContrast;
|
||||
|
||||
const ExtendedColor({
|
||||
required this.seed,
|
||||
required this.value,
|
||||
required this.light,
|
||||
required this.lightHighContrast,
|
||||
required this.lightMediumContrast,
|
||||
required this.dark,
|
||||
required this.darkHighContrast,
|
||||
required this.darkMediumContrast,
|
||||
});
|
||||
}
|
||||
|
||||
class ColorFamily {
|
||||
const ColorFamily({
|
||||
required this.color,
|
||||
required this.onColor,
|
||||
required this.colorContainer,
|
||||
required this.onColorContainer,
|
||||
});
|
||||
|
||||
final Color color;
|
||||
final Color onColor;
|
||||
final Color colorContainer;
|
||||
final Color onColorContainer;
|
||||
}
|
|
@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class Utils {
|
||||
/// Minimum size (width or height) of a interactive component
|
||||
|
@ -82,12 +83,8 @@ class Utils {
|
|||
}
|
||||
|
||||
static Widget trailingSaveWidget(BuildContext context, Function onPressed) {
|
||||
return CupertinoButton(
|
||||
child: Text('Save',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
//TODO: For some reason on android if inherit is the default of true the text color here turns to the background color
|
||||
inherit: Platform.isIOS ? true : false)),
|
||||
return PlatformTextButton(
|
||||
child: Text('Save', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
padding: Platform.isAndroid ? null : EdgeInsets.zero,
|
||||
onPressed: () => onPressed());
|
||||
}
|
||||
|
@ -180,4 +177,19 @@ class Utils {
|
|||
final file = File(result.files.first.path!);
|
||||
return file.readAsString();
|
||||
}
|
||||
|
||||
static TextTheme createTextTheme(BuildContext context, String bodyFontString, String displayFontString) {
|
||||
TextTheme baseTextTheme = Theme.of(context).textTheme;
|
||||
TextTheme bodyTextTheme = GoogleFonts.getTextTheme(bodyFontString, baseTextTheme);
|
||||
TextTheme displayTextTheme = GoogleFonts.getTextTheme(displayFontString, baseTextTheme);
|
||||
TextTheme textTheme = displayTextTheme.copyWith(
|
||||
bodyLarge: bodyTextTheme.bodyLarge,
|
||||
bodyMedium: bodyTextTheme.bodyMedium,
|
||||
bodySmall: bodyTextTheme.bodySmall,
|
||||
labelLarge: bodyTextTheme.labelLarge,
|
||||
labelMedium: bodyTextTheme.labelMedium,
|
||||
labelSmall: bodyTextTheme.labelSmall,
|
||||
);
|
||||
return textTheme;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
google_fonts:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: google_fonts
|
||||
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.1"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -26,6 +26,7 @@ dependencies:
|
|||
flutter_platform_widgets: ^7.0.1
|
||||
path_provider: ^2.0.11
|
||||
file_picker: ^8.1.2
|
||||
google_fonts: ^6.2.1
|
||||
uuid: ^4.4.2
|
||||
package_info_plus: ^8.0.2
|
||||
url_launcher: ^6.1.6
|
||||
|
|
Loading…
Add table
Reference in a new issue