mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
[Gallery] Fix directory structure (#312)
This commit is contained in:
96
gallery/lib/themes/gallery_theme_data.dart
Normal file
96
gallery/lib/themes/gallery_theme_data.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
// Copyright 2019 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class GalleryThemeData {
|
||||
static const _lightFillColor = Colors.black;
|
||||
static const _darkFillColor = Colors.white;
|
||||
|
||||
static Color _lightFocusColor = Colors.black.withOpacity(0.12);
|
||||
static Color _darkFocusColor = Colors.white.withOpacity(0.12);
|
||||
|
||||
static ThemeData lightThemeData =
|
||||
themeData(lightColorScheme, _lightFocusColor);
|
||||
static ThemeData darkThemeData = themeData(darkColorScheme, _darkFocusColor);
|
||||
|
||||
static ThemeData themeData(ColorScheme colorScheme, Color focusColor) {
|
||||
return ThemeData(
|
||||
colorScheme: colorScheme,
|
||||
textTheme: _textTheme,
|
||||
appBarTheme: AppBarTheme(
|
||||
textTheme: _textTheme.apply(bodyColor: colorScheme.onPrimary),
|
||||
color: colorScheme.background,
|
||||
elevation: 0,
|
||||
iconTheme: IconThemeData(color: colorScheme.primary),
|
||||
brightness: colorScheme.brightness,
|
||||
),
|
||||
iconTheme: IconThemeData(color: colorScheme.onPrimary),
|
||||
canvasColor: colorScheme.background,
|
||||
scaffoldBackgroundColor: colorScheme.background,
|
||||
highlightColor: Colors.transparent,
|
||||
accentColor: colorScheme.primary,
|
||||
focusColor: focusColor,
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
behavior: SnackBarBehavior.floating,
|
||||
backgroundColor: Color.alphaBlend(
|
||||
_lightFillColor.withOpacity(0.80),
|
||||
_darkFillColor,
|
||||
),
|
||||
contentTextStyle: _textTheme.subhead.apply(color: _darkFillColor),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static ColorScheme lightColorScheme = ColorScheme(
|
||||
primary: const Color(0xFFB93C5D),
|
||||
primaryVariant: const Color(0xFF117378),
|
||||
secondary: const Color(0xFFEFF3F3),
|
||||
secondaryVariant: const Color(0xFFFAFBFB),
|
||||
background: const Color(0xFFE6EBEB),
|
||||
surface: const Color(0xFFFAFBFB),
|
||||
onBackground: Colors.white,
|
||||
error: _lightFillColor,
|
||||
onError: _lightFillColor,
|
||||
onPrimary: _lightFillColor,
|
||||
onSecondary: const Color(0xFF322942),
|
||||
onSurface: const Color(0xFF241E30),
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
|
||||
static ColorScheme darkColorScheme = ColorScheme(
|
||||
primary: const Color(0xFFFF8383),
|
||||
primaryVariant: const Color(0xFF1CDEC9),
|
||||
secondary: const Color(0xFF4D1F7C),
|
||||
secondaryVariant: const Color(0xFF451B6F),
|
||||
background: const Color(0xFF241E30),
|
||||
surface: const Color(0xFF1F1929),
|
||||
onBackground: Colors.white.withOpacity(0.05),
|
||||
error: _darkFillColor,
|
||||
onError: _darkFillColor,
|
||||
onPrimary: _darkFillColor,
|
||||
onSecondary: _darkFillColor,
|
||||
onSurface: _darkFillColor,
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
|
||||
static const _regular = FontWeight.w400;
|
||||
static const _medium = FontWeight.w500;
|
||||
static const _semiBold = FontWeight.w600;
|
||||
static const _bold = FontWeight.w700;
|
||||
|
||||
static TextTheme _textTheme = TextTheme(
|
||||
display1: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 20.0),
|
||||
caption: GoogleFonts.oswald(fontWeight: _semiBold, fontSize: 16.0),
|
||||
headline: GoogleFonts.oswald(fontWeight: _medium, fontSize: 16.0),
|
||||
subhead: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 16.0),
|
||||
overline: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 12.0),
|
||||
body2: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 14.0),
|
||||
subtitle: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 14.0),
|
||||
body1: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 16.0),
|
||||
title: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 16.0),
|
||||
button: GoogleFonts.montserrat(fontWeight: _semiBold, fontSize: 14.0),
|
||||
);
|
||||
}
|
||||
57
gallery/lib/themes/material_demo_theme_data.dart
Normal file
57
gallery/lib/themes/material_demo_theme_data.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2019 The Flutter team. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MaterialDemoThemeData {
|
||||
static final themeData = ThemeData(
|
||||
colorScheme: _colorScheme,
|
||||
appBarTheme: AppBarTheme(
|
||||
color: _colorScheme.primary,
|
||||
iconTheme: IconThemeData(color: _colorScheme.onPrimary),
|
||||
),
|
||||
bottomAppBarTheme: BottomAppBarTheme(
|
||||
color: _colorScheme.primary,
|
||||
),
|
||||
buttonTheme: ButtonThemeData(
|
||||
textTheme: ButtonTextTheme.primary,
|
||||
colorScheme: _colorScheme,
|
||||
),
|
||||
canvasColor: _colorScheme.background,
|
||||
cursorColor: _colorScheme.primary,
|
||||
toggleableActiveColor: _colorScheme.primary,
|
||||
highlightColor: Colors.transparent,
|
||||
indicatorColor: _colorScheme.onPrimary,
|
||||
primaryColor: _colorScheme.primary,
|
||||
accentColor: _colorScheme.primary,
|
||||
backgroundColor: Colors.white,
|
||||
scaffoldBackgroundColor: _colorScheme.background,
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
typography: Typography(
|
||||
platform: defaultTargetPlatform,
|
||||
englishLike: Typography.englishLike2018,
|
||||
dense: Typography.dense2018,
|
||||
tall: Typography.tall2018,
|
||||
),
|
||||
);
|
||||
|
||||
static const _colorScheme = ColorScheme(
|
||||
primary: Color(0xFF6200EE),
|
||||
primaryVariant: Color(0xFF6200EE),
|
||||
secondary: Color(0xFFFF5722),
|
||||
secondaryVariant: Color(0xFFFF5722),
|
||||
background: Colors.white,
|
||||
surface: Color(0xFFF2F2F2),
|
||||
onBackground: Colors.black,
|
||||
onSurface: Colors.black,
|
||||
error: Colors.red,
|
||||
onError: Colors.white,
|
||||
onPrimary: Colors.white,
|
||||
onSecondary: Colors.white,
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user