Updated ProgressIndicator to M3 (#112139)
This commit is contained in:
@@ -31,6 +31,7 @@ import 'package:gen_defaults/input_chip_template.dart';
|
||||
import 'package:gen_defaults/input_decorator_template.dart';
|
||||
import 'package:gen_defaults/navigation_bar_template.dart';
|
||||
import 'package:gen_defaults/navigation_rail_template.dart';
|
||||
import 'package:gen_defaults/progress_indicator_template.dart';
|
||||
import 'package:gen_defaults/radio_template.dart';
|
||||
import 'package:gen_defaults/surface_tint.dart';
|
||||
import 'package:gen_defaults/switch_template.dart';
|
||||
@@ -80,6 +81,8 @@ Future<void> main(List<String> args) async {
|
||||
'navigation_drawer.json',
|
||||
'navigation_rail.json',
|
||||
'palette.json',
|
||||
'progress_indicator_circular.json',
|
||||
'progress_indicator_linear.json',
|
||||
'radio_button.json',
|
||||
'segmented_button_outlined.json',
|
||||
'shape.json',
|
||||
@@ -126,6 +129,7 @@ Future<void> main(List<String> args) async {
|
||||
InputDecoratorTemplate('InputDecorator', '$materialLib/input_decorator.dart', tokens).updateFile();
|
||||
NavigationBarTemplate('NavigationBar', '$materialLib/navigation_bar.dart', tokens).updateFile();
|
||||
NavigationRailTemplate('NavigationRail', '$materialLib/navigation_rail.dart', tokens).updateFile();
|
||||
ProgressIndicatorTemplate('ProgressIndicator', '$materialLib/progress_indicator.dart', tokens).updateFile();
|
||||
RadioTemplate('Radio<T>', '$materialLib/radio.dart', tokens).updateFile();
|
||||
SurfaceTintTemplate('SurfaceTint', '$materialLib/elevation_overlay.dart', tokens).updateFile();
|
||||
SwitchTemplate('Switch', '$materialLib/switch.dart', tokens).updateFile();
|
||||
|
||||
42
dev/tools/gen_defaults/lib/progress_indicator_template.dart
Normal file
42
dev/tools/gen_defaults/lib/progress_indicator_template.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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 ProgressIndicatorTemplate extends TokenTemplate {
|
||||
const ProgressIndicatorTemplate(super.blockName, super.fileName, super.tokens, {
|
||||
super.colorSchemePrefix = '_colors.',
|
||||
});
|
||||
|
||||
@override
|
||||
String generate() => '''
|
||||
class _Circular${blockName}DefaultsM3 extends ProgressIndicatorThemeData {
|
||||
_Circular${blockName}DefaultsM3(this.context);
|
||||
|
||||
final BuildContext context;
|
||||
late final ColorScheme _colors = Theme.of(context).colorScheme;
|
||||
|
||||
static const double circularProgressIndicatorSize = ${tokens['md.comp.circular-progress-indicator.size']};
|
||||
|
||||
@override
|
||||
Color get color => ${componentColor('md.comp.circular-progress-indicator.active-indicator')};
|
||||
}
|
||||
|
||||
class _Linear${blockName}DefaultsM3 extends ProgressIndicatorThemeData {
|
||||
_Linear${blockName}DefaultsM3(this.context);
|
||||
|
||||
final BuildContext context;
|
||||
late final ColorScheme _colors = Theme.of(context).colorScheme;
|
||||
|
||||
@override
|
||||
Color get color => ${componentColor('md.comp.linear-progress-indicator.active-indicator')};
|
||||
|
||||
@override
|
||||
Color get linearTrackColor => ${componentColor('md.comp.linear-progress-indicator.track')};
|
||||
|
||||
@override
|
||||
double get linearMinHeight => ${tokens['md.comp.linear-progress-indicator.track.height']};
|
||||
}
|
||||
''';
|
||||
}
|
||||
Reference in New Issue
Block a user