diff --git a/lib/core/theme/app_theme.dart b/lib/core/theme/app_theme.dart new file mode 100644 index 0000000..b5074a9 --- /dev/null +++ b/lib/core/theme/app_theme.dart @@ -0,0 +1,190 @@ +import 'package:flutter/material.dart'; + +abstract class AppTheme { + static const Color _primary = Color(0xFF00C853); + static const Color _primaryLight = Color(0xFFE6F9EE); + static const Color _primaryDark = Color(0xFF00A343); + static const Color _negative = Color(0xFFEF4444); + + static const Color _backgroundLight = Color(0xFFFFFFFF); + static const Color _surfaceLight = Color(0xFFF9FAFB); + static const Color _cardLight = Color(0xFFFFFFFF); + static const Color _dividerLight = Color(0xFFE5E7EB); + static const Color _textPrimaryLight = Color(0xFF111827); + static const Color _textSecondaryLight = Color(0xFF6B7280); + static const Color _textHintLight = Color(0xFF9CA3AF); + + static const Color _backgroundDark = Color(0xFF0C0B10); + static const Color _surfaceDark = Color(0xFF14131A); + static const Color _cardDark = Color(0xFF1C1A24); + static const Color _dividerDark = Color(0xFF25232F); + static const Color _textPrimaryDark = Color(0xFFF9FAFB); + static const Color _textSecondaryDark = Color(0xFFA0A0B0); + static const Color _textHintDark = Color(0xFF6B6B80); + + static ThemeData lightTheme = ThemeData( + useMaterial3: true, + brightness: Brightness.light, + colorScheme: const ColorScheme.light( + primary: _primary, + primaryContainer: _primaryLight, + secondary: _primaryDark, + surface: _surfaceLight, + error: _negative, + onPrimary: Colors.black, + ), + scaffoldBackgroundColor: _backgroundLight, + cardColor: _cardLight, + dividerColor: _dividerLight, + textTheme: const TextTheme( + displayLarge: TextStyle( + fontSize: 32, + fontWeight: FontWeight.w700, + letterSpacing: -0.5, + color: _textPrimaryLight, + ), + displayMedium: TextStyle( + fontSize: 28, + fontWeight: FontWeight.w700, + letterSpacing: -0.5, + color: _textPrimaryLight, + ), + headlineLarge: TextStyle( + fontSize: 24, + fontWeight: FontWeight.w600, + letterSpacing: -0.3, + color: _textPrimaryLight, + ), + headlineMedium: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + letterSpacing: -0.2, + color: _textPrimaryLight, + ), + headlineSmall: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: _textPrimaryLight, + ), + bodyLarge: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + height: 1.5, + color: _textPrimaryLight, + ), + bodyMedium: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + height: 1.5, + color: _textSecondaryLight, + ), + bodySmall: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w400, + height: 1.4, + color: _textHintLight, + ), + labelLarge: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + color: _textPrimaryLight, + ), + labelMedium: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + color: _textSecondaryLight, + ), + labelSmall: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w500, + letterSpacing: 0.2, + color: _textHintLight, + ), + ), + ); + + static ThemeData darkTheme = ThemeData( + useMaterial3: true, + brightness: Brightness.dark, + colorScheme: const ColorScheme.dark( + primary: _primary, + primaryContainer: _primaryDark, + secondary: _primaryLight, + surface: _surfaceDark, + error: _negative, + onPrimary: Colors.black, + ), + scaffoldBackgroundColor: _backgroundDark, + cardColor: _cardDark, + dividerColor: _dividerDark, + textTheme: const TextTheme( + displayLarge: TextStyle( + fontSize: 32, + fontWeight: FontWeight.w700, + letterSpacing: -0.5, + color: _textPrimaryDark, + ), + displayMedium: TextStyle( + fontSize: 28, + fontWeight: FontWeight.w700, + letterSpacing: -0.5, + color: _textPrimaryDark, + ), + headlineLarge: TextStyle( + fontSize: 24, + fontWeight: FontWeight.w600, + letterSpacing: -0.3, + color: _textPrimaryDark, + ), + headlineMedium: TextStyle( + fontSize: 20, + fontWeight: FontWeight.w600, + letterSpacing: -0.2, + color: _textPrimaryDark, + ), + headlineSmall: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: _textPrimaryDark, + ), + bodyLarge: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w400, + height: 1.5, + color: _textPrimaryDark, + ), + bodyMedium: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + height: 1.5, + color: _textSecondaryDark, + ), + bodySmall: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w400, + height: 1.4, + color: _textHintDark, + ), + labelLarge: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + color: _textPrimaryDark, + ), + labelMedium: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w500, + letterSpacing: 0.1, + color: _textSecondaryDark, + ), + labelSmall: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w500, + letterSpacing: 0.2, + color: _textHintDark, + ), + ), + ); +} diff --git a/lib/main.dart b/lib/main.dart index 7b7f5b6..f757ea2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:zplit/core/theme/app_theme.dart'; void main() { runApp(const MyApp()); @@ -7,116 +8,12 @@ void main() { class MyApp extends StatelessWidget { const MyApp({super.key}); - // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // TRY THIS: Try running your application with "flutter run". You'll see - // the application has a purple toolbar. Then, without quitting the app, - // try changing the seedColor in the colorScheme below to Colors.green - // and then invoke "hot reload" (save your changes or press the "hot - // reload" button in a Flutter-supported IDE, or press "r" if you used - // the command line to start the app). - // - // Notice that the counter didn't reset back to zero; the application - // state is not lost during the reload. To reset the state, use hot - // restart instead. - // - // This works for code too, not just values: Most code changes can be - // tested with just a hot reload. - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // TRY THIS: Try changing the color here to a specific color (to - // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar - // change color while the other colors stay the same. - backgroundColor: Theme.of(context).colorScheme.inversePrimary, - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - // - // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" - // action in the IDE, or press "p" in the console), to see the - // wireframe for each widget. - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text('You have pushed the button this many times:'), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. + title: 'Zplit', + theme: AppTheme.lightTheme, + darkTheme: AppTheme.darkTheme, ); } }