Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@fredgrott
fredgrott / custom_app_bar_theme.dart
Created June 23, 2024 16:59
custom app bar theme
// Copyright 2024 Fredrick Allan Grott. 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:flutter/services.dart';
import 'package:universal_platform/universal_platform.dart';
/// An example of how to do themed platform adaptations in which you do not
/// have to wait for the flutter SDK team to get them via the ThemeData
@fredgrott
fredgrott / snippet.dart
Created June 23, 2024 16:34
checkbox snippet
@override
Widget build(BuildContext context) {
switch (widget._checkboxType) {
case _CheckboxType.material:
break;
case _CheckboxType.adaptive:
final ThemeData theme = Theme.of(context);
switch (theme.platform) {
case TargetPlatform.android:
@fredgrott
fredgrott / color_scheme_dark.dart
Created June 22, 2024 16:47
color scheme dark
// 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';
//TODO: Re-do when contrastLevel of ColorScheme lands in beta
ColorScheme colorSchemeDark(Color seedColor) {
return ColorScheme.fromSeed(
brightness: Brightness.dark,
@fredgrott
fredgrott / color_scheme_light.dart
Created June 22, 2024 16:46
color scheme light
// Copyright 2024 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// ignore_for_file: avoid_redundant_argument_values
import 'package:flutter/material.dart';
//TODO: Re-do when contrastLevel of ColorScheme lands in beta
@fredgrott
fredgrott / color_seeds.dart
Created June 22, 2024 16:44
primary seed color
// Copyright 2024 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// best practice wise we always do color seeds
// and brand colors in light mode.
import 'package:flutter/material.dart';
@fredgrott
fredgrott / snippet.dart
Created June 22, 2024 15:58
app snippet
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:sdk_cs_googlefonts/src/sample_feature/sample_item_details_view.dart';
import 'package:sdk_cs_googlefonts/src/sample_feature/sample_item_list_view.dart';
import 'package:sdk_cs_googlefonts/src/settings/settings_controller.dart';
import 'package:sdk_cs_googlefonts/src/settings/settings_view.dart';
import 'package:sdk_cs_googlefonts/src/themes/color_scheme_dark.dart';
import 'package:sdk_cs_googlefonts/src/themes/color_scheme_light.dart';
// Copyright 2024 Fredrick Allan Grott. 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:material_color_utilities/material_color_utilities.dart';
@override
Widget build(BuildContext context) {
// Wrap MaterialApp with a DynamicColorBuilder.
return DynamicColorBuilder(
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
ColorScheme lightColorScheme;
ColorScheme darkColorScheme;
if (lightDynamic != null && darkDynamic != null) {
// On Android S+ devices, use the provided dynamic color scheme.
@fredgrott
fredgrott / primary_text_theme.dart
Created June 21, 2024 15:31
primary text theme
// Copyright 2024 Fredrick Allan Grott. 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';
//TODO: When fixes to variable fonts lands redo
// to add wght, opsz, ital, and grad and note
// grad has to be set differently for dark
@fredgrott
fredgrott / text_theme_dark.dart
Created June 21, 2024 15:29
text theme dark
// Copyright 2024 Fredrick Allan Grott. 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';
//TODO: When fixes to variable fonts lands redo
// to add wght, opsz, ital, and grad and note
// grad has to be set differently for dark