143 lines
4.9 KiB
Dart

// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:wyatt_ui_kit_example/home.dart';
import 'package:wyatt_ui_kit_example/theme_extension.dart';
void main(List<String> args) {
const forcePage = int.fromEnvironment('PAGE');
runApp(
const App(
defaultPage: forcePage,
),
);
}
class App extends StatelessWidget {
const App({required this.defaultPage, super.key});
final int defaultPage;
@override
Widget build(BuildContext context) => AdaptiveTheme(
initial: AdaptiveThemeMode.light,
light: ThemeData.light().copyWith(
appBarTheme: AppBarTheme(
foregroundColor: const Color.fromRGBO(36, 38, 42, 1),
backgroundColor: Colors.white,
titleTextStyle: GoogleFonts.montserrat(
fontSize: 18,
fontWeight: FontWeight.w500,
color: const Color.fromRGBO(36, 38, 42, 1),
),
),
scaffoldBackgroundColor: Colors.white,
extensions: <ThemeExtension<dynamic>>[
CustomCardColorExtension(
backgroundColors: const [
Color.fromRGBO(246, 246, 246, 1),
],
secondaryBackgroundColors: Colors.white,
borderColor: const [
Color.fromRGBO(221, 224, 227, 1),
Color.fromRGBO(202, 204, 212, 1),
],
title: GoogleFonts.montserrat(
fontSize: 24,
fontWeight: FontWeight.w500,
color: const Color.fromRGBO(36, 38, 42, 1),
),
subtitle: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(36, 38, 42, 1),
),
body: GoogleFonts.montserrat(
fontSize: 12,
fontWeight: FontWeight.w300,
height: 1.7,
color: const Color.fromRGBO(36, 38, 42, 1),
),
),
// FlatButtonTheme.light(),
// SymbolButtonTheme.light(),
],
),
dark: ThemeData.dark().copyWith(
appBarTheme: AppBarTheme(
foregroundColor: Colors.white,
backgroundColor: const Color.fromRGBO(56, 60, 64, 1),
titleTextStyle: GoogleFonts.montserrat(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
scaffoldBackgroundColor: const Color.fromRGBO(56, 60, 64, 1),
extensions: <ThemeExtension<dynamic>>[
CustomCardColorExtension(
secondaryBackgroundColors: Colors.white.withOpacity(0.04),
backgroundColors: [
Colors.white.withOpacity(0.04),
],
borderColor: const [
Color.fromRGBO(96, 101, 106, 1),
Color.fromRGBO(56, 60, 64, 1),
],
title: GoogleFonts.montserrat(
fontSize: 24,
fontWeight: FontWeight.w500,
color: Colors.white,
),
subtitle: GoogleFonts.montserrat(
fontSize: 15,
fontWeight: FontWeight.w300,
color: Colors.white,
),
body: GoogleFonts.montserrat(
fontSize: 12,
fontWeight: FontWeight.w300,
height: 1.7,
color: Colors.white,
),
),
// FlatButtonTheme.dark(),
// SymbolButtonTheme.dark(),
],
),
builder: (light, dark) => MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
theme: light,
darkTheme: dark,
supportedLocales: const [
Locale('fr', ''),
],
title: title,
home: Home(
forceIndex: defaultPage,
),
),
);
}