From b4096457f8107d2f5a3e05491976ab09e63ffc51 Mon Sep 17 00:00:00 2001 From: ken-morel Date: Fri, 20 Jun 2025 20:28:20 +0100 Subject: [PATCH 1/5] created primal theme for tests --- lib/theme.dart | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/theme.dart diff --git a/lib/theme.dart b/lib/theme.dart new file mode 100644 index 0000000..421fbf1 --- /dev/null +++ b/lib/theme.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; + +const harbourHaze = [ + Color(0xFF909EAE), // #909EAE -- sage + Color(0xFF5C8DC5), // #5C8DC5 -- blue + Color(0xFFAD9E90), // #AD9E90 -- bright gray-brown + Color(0xFF736F60), // #736F60 -- brown +]; + +Map themes = { + 'harbourHaze': ThemeData( + brightness: Brightness.light, + splashColor: harbourHaze[0], + primaryColor: harbourHaze[1], + colorScheme: ColorScheme.light( + primary: harbourHaze[1], + secondary: harbourHaze[0], + surface: harbourHaze[2], + onSurface: harbourHaze[3], + ), + inputDecorationTheme: InputDecorationTheme( + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.0), + borderSide: BorderSide(color: harbourHaze[2]), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.0), + borderSide: BorderSide(color: harbourHaze[1]), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.0), + borderSide: BorderSide(color: harbourHaze[2]), + ), + ), + textTheme: TextTheme(), + useMaterial3: true, + highlightColor: harbourHaze[1], + focusColor: harbourHaze[0], + ), +}; From 002d0ec56267a03c493106a4a290deac9c37c98e Mon Sep 17 00:00:00 2001 From: ken-morel Date: Fri, 20 Jun 2025 21:23:24 +0100 Subject: [PATCH 2/5] generated theme, added google fonts --- lib/app.dart | 6 +- lib/main.dart | 2 + lib/theme.dart | 381 +++++++++++++++++- macos/Flutter/GeneratedPluginRegistrant.swift | 4 + pubspec.lock | 199 ++++++++- pubspec.yaml | 2 + 6 files changed, 569 insertions(+), 25 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index c43e02e..9e4dc96 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:ins/theme.dart'; +import 'package:ins/pages/home.dart'; class ISApp extends StatelessWidget { const ISApp({super.key}); @@ -7,8 +9,8 @@ class ISApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'IS', - theme: ThemeData(), - home: Center(child: Text("Hello RB")), + theme: themeManager.getTheme(), + home: getPage(), ); } } diff --git a/lib/main.dart b/lib/main.dart index 7fbca97..8cd4b7e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:ins/app.dart'; +import 'package:ins/theme.dart'; void main() { + themeManager.initialize(); runApp(const ISApp()); } diff --git a/lib/theme.dart b/lib/theme.dart index 421fbf1..eba41a9 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -1,40 +1,377 @@ import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:google_fonts/google_fonts.dart'; -const harbourHaze = [ - Color(0xFF909EAE), // #909EAE -- sage - Color(0xFF5C8DC5), // #5C8DC5 -- blue - Color(0xFFAD9E90), // #AD9E90 -- bright gray-brown - Color(0xFF736F60), // #736F60 -- brown +Color lighten(Color color, [double amount = .1]) { + assert(amount >= 0 && amount <= 1); + final hsl = HSLColor.fromColor(color); + final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0)); + return hslLight.toColor(); +} + +Color darken(Color color, [double amount = .1]) { + assert(amount >= 0 && amount <= 1); + final hsl = HSLColor.fromColor(color); + final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0)); + return hslDark.toColor(); +} + +const List harbourHazePalette = [ + Color( + 0xFF909EAE, + ), // sage (Cool Grayish Blue/Green) - Good for secondary, backgrounds, muted accents + Color( + 0xFF5C8DC5, + ), // blue (Moderate, slightly desaturated Blue) - Good for primary + Color( + 0xFFAD9E90, + ), // brightGrayBrown (Light, warm Gray/Beige) - Good for surfaces, containers + Color( + 0xFF736F60, + ), // brown (Muted, earthy Brown) - Good for text, outlines, darker accents ]; +final Color hhSage = harbourHazePalette[0]; +final Color hhBlue = harbourHazePalette[1]; +final Color hhBrightGrayBrown = harbourHazePalette[2]; +final Color hhBrown = harbourHazePalette[3]; + +ThemeData _buildHarbourHazeTheme() { + // Define base colors from the palette for Material 3 ColorScheme + final Color primaryColor = hhBlue; + final Color secondaryColor = hhSage; + final Color surfaceColor = lighten( + hhBrightGrayBrown, + 0.35, + ); // Lighter for main surfaces + final Color errorColor = const Color(0xFFB00020); // Standard error red + + // Define "on" colors (colors for text/icons on top of the base colors) + final Color onPrimaryColor = Colors.black; // For text on primaryColor + final Color onSecondaryColor = darken( + hhBrown, + 0.9, + ); // Darker brown for text on secondaryColor + final Color onSurfaceColor = darken( + hhBrown, + 0.5, + ); // Main text color on surfaceColor + final Color onErrorColor = Colors.white; + + // Create the ColorScheme + final ColorScheme colorScheme = ColorScheme( + brightness: Brightness.light, + + primary: primaryColor, + onPrimary: onPrimaryColor, + primaryContainer: lighten(primaryColor, 0.3), + onPrimaryContainer: darken( + primaryColor, + 0.3, + ), // Or hhBrown if contrast is better + + secondary: secondaryColor, + onSecondary: onSecondaryColor, + secondaryContainer: lighten(secondaryColor, 0.25), + onSecondaryContainer: darken(secondaryColor, 0.3), // Or hhBrown + + tertiary: hhBrightGrayBrown, // Using this as a tertiary accent + onTertiary: hhBrown, + tertiaryContainer: lighten(hhBrightGrayBrown, 0.1), + onTertiaryContainer: darken(hhBrown, 0.05), + + error: errorColor, + onError: onErrorColor, + errorContainer: lighten(errorColor, 0.4), + onErrorContainer: darken(errorColor, 0.2), -Map themes = { - 'harbourHaze': ThemeData( + surface: surfaceColor, // Main surfaces like cards, dialogs + onSurface: onSurfaceColor, // Text on surface + + surfaceContainerHighest: + hhBrightGrayBrown, // For elements like Card backgrounds, chip backgrounds + onSurfaceVariant: hhBrown, // Text on surfaceVariant + + outline: hhBrown.withAlpha(128), + outlineVariant: hhSage.withAlpha(180), + + shadow: Colors.black.withAlpha(26), + scrim: Colors.black.withAlpha(100), + + inverseSurface: darken(onSurfaceColor, 0.1), // For snackbars, etc. + onInverseSurface: lighten(surfaceColor, 0.1), + inversePrimary: lighten(primaryColor, 0.2), + surfaceTint: primaryColor.withAlpha(10), // Tint for elevations + ); + + // Define TextTheme using GoogleFonts and ColorScheme + final TextTheme originalTextTheme = TextTheme( + displayLarge: GoogleFonts.robotoFlex( + fontSize: 32, + fontWeight: FontWeight.w800, + color: colorScheme.primary, + ), + headlineMedium: GoogleFonts.robotoFlex( + fontSize: 24, + fontWeight: FontWeight.w700, + letterSpacing: 0.25, + color: colorScheme.onSurface, + ), + titleLarge: GoogleFonts.robotoFlex( + fontSize: 20, + fontWeight: FontWeight.w600, + color: colorScheme.onSurface.withAlpha(110), + ), + bodyLarge: GoogleFonts.merriweather( + // For prominent body text + fontSize: 18, + height: 1.5, + color: colorScheme.onSurface, + ), + bodyMedium: GoogleFonts.merriweather( + // Standard body text + fontSize: 16, + height: 1.6, + color: colorScheme.onSurface, + ), + labelLarge: GoogleFonts.robotoFlex( + // For buttons + fontSize: 14, + fontWeight: FontWeight.w600, // Buttons often have bolder labels + letterSpacing: 0.2, + color: colorScheme.onPrimary, + ), // Assuming buttons use primary color + titleMedium: GoogleFonts.robotoFlex( + // For list tiles, smaller titles + fontSize: 16, + fontWeight: FontWeight.w500, + color: colorScheme.onSurfaceVariant, + ), + bodySmall: GoogleFonts.merriweather( + // Captions, smaller text + fontSize: 12, + height: 1.4, + color: colorScheme.onSurface.withOpacity(0.7), + ), + ); + return ThemeData( brightness: Brightness.light, - splashColor: harbourHaze[0], - primaryColor: harbourHaze[1], - colorScheme: ColorScheme.light( - primary: harbourHaze[1], - secondary: harbourHaze[0], - surface: harbourHaze[2], - onSurface: harbourHaze[3], + colorScheme: colorScheme, + primaryColor: primaryColor, // Still useful for some older widgets + scaffoldBackgroundColor: colorScheme.surface, + + splashColor: colorScheme.primary.withAlpha(30), + highlightColor: colorScheme.primary.withAlpha(26), + focusColor: colorScheme.secondary.withAlpha(30), + + appBarTheme: AppBarTheme( + backgroundColor: colorScheme.surface, // Or surfaceContainerHighest + foregroundColor: colorScheme.onSurfaceVariant, // For title and icons + elevation: 1, + shadowColor: colorScheme.shadow, + titleTextStyle: originalTextTheme.titleLarge?.copyWith( + color: colorScheme.primary, + ), + iconTheme: IconThemeData(color: colorScheme.secondary), // Or primary ), + + textTheme: originalTextTheme, + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: colorScheme.surfaceContainerHighest.withAlpha(128), + contentPadding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 12.0, + ), border: OutlineInputBorder( borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide(color: harbourHaze[2]), + borderSide: BorderSide(color: colorScheme.outline, width: 1.0), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.0), + borderSide: BorderSide( + color: colorScheme.outline.withAlpha(175), + width: 1.0, + ), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide(color: harbourHaze[1]), + borderSide: BorderSide(color: colorScheme.primary, width: 2.0), ), - enabledBorder: OutlineInputBorder( + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.0), + borderSide: BorderSide(color: colorScheme.error, width: 1.5), + ), + focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8.0), - borderSide: BorderSide(color: harbourHaze[2]), + borderSide: BorderSide(color: colorScheme.error, width: 2.0), + ), + labelStyle: originalTextTheme.bodyMedium?.copyWith( + color: colorScheme.onSurfaceVariant, + ), + hintStyle: originalTextTheme.bodyMedium?.copyWith( + color: colorScheme.onSurfaceVariant.withOpacity(0.7), ), ), - textTheme: TextTheme(), + + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: colorScheme.primary, + foregroundColor: colorScheme.onPrimary, + textStyle: originalTextTheme.labelLarge, // Already has onPrimary color + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + elevation: 2, + ), + ), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + foregroundColor: colorScheme.primary, + textStyle: originalTextTheme.labelLarge?.copyWith( + color: colorScheme.primary, + fontWeight: FontWeight.w600, + ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + foregroundColor: colorScheme.primary, + side: BorderSide(color: colorScheme.primary, width: 1.5), + textStyle: originalTextTheme.labelLarge?.copyWith( + color: colorScheme.primary, + fontWeight: FontWeight.w600, + ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + + cardTheme: CardThemeData( + color: colorScheme + .surfaceContainerHighest, // Slightly different from main surface for visual separation + elevation: 0.5, // Subtle elevation + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: BorderSide( + color: colorScheme.outlineVariant.withAlpha(128), + width: 1, + ), + ), + margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + ), + + dividerTheme: DividerThemeData( + color: colorScheme.outlineVariant.withAlpha(150), + thickness: 1, + space: 24, + ), + + chipTheme: ChipThemeData( + backgroundColor: colorScheme.secondaryContainer.withAlpha(175), + labelStyle: originalTextTheme.bodySmall?.copyWith( + color: colorScheme.onSecondaryContainer, + ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + side: BorderSide.none, + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + ), + + dialogTheme: DialogThemeData( + backgroundColor: colorScheme.surface, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + titleTextStyle: originalTextTheme.headlineMedium?.copyWith( + color: colorScheme.onSurface, + ), + contentTextStyle: originalTextTheme.bodyMedium?.copyWith( + color: colorScheme.onSurface.withAlpha(200), + ), + ), + + floatingActionButtonTheme: FloatingActionButtonThemeData( + backgroundColor: colorScheme.secondary, // Or primary or tertiary + foregroundColor: colorScheme.onSecondary, + elevation: 4, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + ), + + listTileTheme: ListTileThemeData( + iconColor: colorScheme.secondary, + titleTextStyle: originalTextTheme.titleMedium, + subtitleTextStyle: originalTextTheme.bodySmall?.copyWith( + color: colorScheme.onSurfaceVariant.withAlpha(200), + ), + ), + + bottomNavigationBarTheme: BottomNavigationBarThemeData( + backgroundColor: colorScheme.surface, // or surfaceContainer + selectedItemColor: colorScheme.primary, + unselectedItemColor: colorScheme.onSurfaceVariant.withOpacity(0.7), + selectedLabelStyle: originalTextTheme.bodySmall?.copyWith( + fontWeight: FontWeight.w600, + ), + unselectedLabelStyle: originalTextTheme.bodySmall, + elevation: 2, + ), + + tabBarTheme: TabBarThemeData( + labelColor: colorScheme.primary, + unselectedLabelColor: colorScheme.onSurfaceVariant.withOpacity(0.8), + indicator: UnderlineTabIndicator( + borderSide: BorderSide(color: colorScheme.primary, width: 2.0), + ), + labelStyle: originalTextTheme.labelLarge?.copyWith( + color: colorScheme.primary, + fontWeight: FontWeight.w600, + ), // color set by labelColor + unselectedLabelStyle: originalTextTheme.labelLarge?.copyWith( + color: colorScheme.onSurfaceVariant, + fontWeight: FontWeight.w500, + ), // color set by unselectedLabelColor + ), + + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: OpenUpwardsPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), // Good practice + TargetPlatform.linux: OpenUpwardsPageTransitionsBuilder(), + TargetPlatform.macOS: CupertinoPageTransitionsBuilder(), + TargetPlatform.windows: FadeUpwardsPageTransitionsBuilder(), + }, + ), useMaterial3: true, - highlightColor: harbourHaze[1], - focusColor: harbourHaze[0], - ), + ); +} + +// Your themes map +final Map themes = { + 'harbourHaze': _buildHarbourHazeTheme(), + // You can add more themes here if needed }; +const themeKey = "app_theme"; + +class ThemeManager with ChangeNotifier { + static final ThemeManager _instance = ThemeManager._internal(); + factory ThemeManager() => _instance; + ThemeManager._internal(); + + String theme = "harbourHaze"; + + Future initialize() async { + final prefs = await SharedPreferences.getInstance(); + final themename = prefs.getString(themeKey) ?? 'harbourHaze'; + setTheme(themename); + notifyListeners(); + } + + ThemeData getTheme() { + return themes[theme]!; + } + + Future setTheme(String themename) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setString(themeKey, themename); + notifyListeners(); + } +} + +final themeManager = ThemeManager(); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..b8e2b22 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import path_provider_foundation +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index eaa659f..d9fd50d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" cupertino_icons: dependency: "direct main" description: @@ -57,6 +65,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" flutter: dependency: "direct main" description: flutter @@ -75,6 +99,35 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.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: + name: http + sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" leak_tracker: dependency: transitive description: @@ -139,6 +192,126 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9 + url: "https://pub.dev" + source: hosted + version: "2.2.17" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac" + url: "https://pub.dev" + source: hosted + version: "2.4.10" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -192,6 +365,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.4" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" vector_math: dependency: transitive description: @@ -208,6 +389,22 @@ packages: url: "https://pub.dev" source: hosted version: "15.0.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" sdks: dart: ">=3.8.1 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index fc29d04..51af4b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,6 +33,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 + shared_preferences: ^2.5.3 + google_fonts: ^6.2.1 dev_dependencies: flutter_test: From ef06c22eee5e8bb49e3c3325bf3f9918b84a6055 Mon Sep 17 00:00:00 2001 From: ken-morel Date: Fri, 20 Jun 2025 21:23:51 +0100 Subject: [PATCH 3/5] added test home and welcome in pages/ --- lib/pages/home.dart | 6 ++++++ lib/pages/welcomepage.dart | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lib/pages/home.dart create mode 100644 lib/pages/welcomepage.dart diff --git a/lib/pages/home.dart b/lib/pages/home.dart new file mode 100644 index 0000000..4d518c1 --- /dev/null +++ b/lib/pages/home.dart @@ -0,0 +1,6 @@ +import 'package:flutter/material.dart'; +import 'welcomepage.dart'; + +Widget getPage() { + return WelcomePage(); +} diff --git a/lib/pages/welcomepage.dart b/lib/pages/welcomepage.dart new file mode 100644 index 0000000..bb436e9 --- /dev/null +++ b/lib/pages/welcomepage.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +class WelcomePage extends StatelessWidget { + const WelcomePage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Welcome')), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text('Welcome to the App!'), + ElevatedButton( + onPressed: () {}, + child: const Text('Go to Home Page'), + ), + ], + ), + ), + ); + } +} From 0ed43e2a9c9a164e25eccc04ee40b1e636c3aac6 Mon Sep 17 00:00:00 2001 From: ken-morel Date: Fri, 20 Jun 2025 21:28:58 +0100 Subject: [PATCH 4/5] Wrapped app in animation builder for theme autoswitch and hotreload on theme chanje --- lib/app.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index 9e4dc96..2f08692 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -1,16 +1,21 @@ import 'package:flutter/material.dart'; import 'package:ins/theme.dart'; -import 'package:ins/pages/home.dart'; +import 'package:ins/pages/home.dart' as home; class ISApp extends StatelessWidget { const ISApp({super.key}); @override Widget build(BuildContext context) { - return MaterialApp( - title: 'IS', - theme: themeManager.getTheme(), - home: getPage(), + return AnimatedBuilder( + animation: themeManager, + builder: (_, _) { + return MaterialApp( + title: 'IS', + theme: themeManager.getTheme(), + home: home.getPage(), + ); + }, ); } } From 39a9914fb87d2c05912cefd085b7b0277b4eeaba Mon Sep 17 00:00:00 2001 From: ken-morel Date: Fri, 20 Jun 2025 21:55:05 +0100 Subject: [PATCH 5/5] Updated action for firebase deploy to work --- .../firebase-hosting-pull-request.yml | 3 + .github/workflows/make_binaries.yml | 69 ------------------- 2 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/make_binaries.yml diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 9ffd4ec..6b88d71 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -13,6 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: "stable" - run: flutter build web - uses: FirebaseExtended/action-hosting-deploy@v0 with: diff --git a/.github/workflows/make_binaries.yml b/.github/workflows/make_binaries.yml deleted file mode 100644 index 286eb13..0000000 --- a/.github/workflows/make_binaries.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Build, Deploy, and Release - -on: - release: - types: [created] - push: - tags: - - 'v*' - -jobs: - build-deploy-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - - - name: Install dependencies - run: flutter pub get - - - name: Build Web Version - run: flutter build web --release --dart-define=APP_ENV=prod - - name: Accept Android SDK licenses - run: echo yes | sdkmanager --licenses - - - name: Build APK - run: | - flutter build apk --release --dart-define=APP_ENV=prod - mv build/app/outputs/apk/release/app-release.apk build/app-release-${{ github.ref_name }}.apk - - - name: Zip Web Build - run: zip -r web-build-${{ github.ref_name }}.zip build/web - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install Firebase CLI - run: npm install -g firebase-tools - - - name: Set up Julia - uses: julia-actions/setup-julia@v1 - with: - version: '1.6' - - - name: Deploy to Firebase - run: julia deployfirebase.jl - env: - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - - - name: Upload Release Assets - uses: softprops/action-gh-release@v1 - with: - files: | - build/app-release-${{ github.ref_name }}.apk - web-build-${{ github.ref_name }}.zip - body: | - Automatic build for version ${{ github.ref_name }} - - Web version deployed to Firebase - - APK attached for mobile installation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}