Support Material 3 in bottom sheet (#112466)
This commit is contained in:
30
dev/tools/gen_defaults/lib/bottom_sheet_template.dart
Normal file
30
dev/tools/gen_defaults/lib/bottom_sheet_template.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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 {
|
||||
const BottomSheetTemplate(super.blockName, super.fileName, super.tokens);
|
||||
|
||||
@override
|
||||
String generate() => '''
|
||||
// Generated version ${tokens["version"]}
|
||||
class _${blockName}DefaultsM3 extends BottomSheetThemeData {
|
||||
const _${blockName}DefaultsM3(this.context)
|
||||
: 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")},
|
||||
);
|
||||
|
||||
final BuildContext context;
|
||||
|
||||
@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")};
|
||||
}
|
||||
''';
|
||||
}
|
||||
@@ -177,6 +177,12 @@ abstract class TokenTemplate {
|
||||
if (topLeft == topRight && topLeft == bottomLeft && topLeft == bottomRight) {
|
||||
return '${prefix}RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular($topLeft)))';
|
||||
}
|
||||
if (topLeft == topRight && bottomLeft == bottomRight) {
|
||||
return '${prefix}RoundedRectangleBorder(borderRadius: BorderRadius.vertical('
|
||||
'${topLeft > 0 ? 'top: Radius.circular($topLeft),':''}'
|
||||
'${bottomLeft > 0 ? 'bottom: Radius.circular($bottomLeft),':''}'
|
||||
'))';
|
||||
}
|
||||
return '${prefix}RoundedRectangleBorder(borderRadius: '
|
||||
'BorderRadius.only('
|
||||
'topLeft: Radius.circular(${shape['topLeft']}), '
|
||||
|
||||
Reference in New Issue
Block a user