bottom_sheet_template.dart 1.48 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'template.dart';

class BottomSheetTemplate extends TokenTemplate {
8 9 10 11
  const BottomSheetTemplate(
    super.blockName,
    super.fileName,
    super.tokens, {
12 13
    super.colorSchemePrefix = '_colors.',
  });
14 15 16 17

  @override
  String generate() => '''
class _${blockName}DefaultsM3 extends BottomSheetThemeData {
18
  _${blockName}DefaultsM3(this.context)
19 20 21 22
    : super(
      elevation: ${elevation("md.comp.sheet.bottom.docked.standard.container")},
      modalElevation: ${elevation("md.comp.sheet.bottom.docked.modal.container")},
      shape: ${shape("md.comp.sheet.bottom.docked.container")},
23
      constraints: const BoxConstraints(maxWidth: 640),
24 25 26
    );

  final BuildContext context;
27
  late final ColorScheme _colors = Theme.of(context).colorScheme;
28 29 30 31 32 33

  @override
  Color? get backgroundColor => ${componentColor("md.comp.sheet.bottom.docked.container")};

  @override
  Color? get surfaceTintColor => ${componentColor("md.comp.sheet.bottom.docked.container.surface-tint-layer")};
34 35 36

  @override
  Color? get shadowColor => Colors.transparent;
37 38 39 40 41 42

  @override
  Color? get dragHandleColor => ${componentColor("md.comp.sheet.bottom.docked.drag-handle")};

  @override
  Size? get dragHandleSize => ${size("md.comp.sheet.bottom.docked.drag-handle")};
43 44 45

  @override
  BoxConstraints? get constraints => const BoxConstraints(maxWidth: 640.0);
46 47 48
}
''';
}