text_field_template.dart 1.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// 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 TextFieldTemplate extends TokenTemplate {
  const TextFieldTemplate(super.blockName, super.fileName, super.tokens);

  @override
  String generate() => '''
12 13 14 15 16 17 18
TextStyle? _m3StateInputStyle(BuildContext context) => MaterialStateTextStyle.resolveWith((Set<MaterialState> states) {
  if (states.contains(MaterialState.disabled)) {
    return TextStyle(color: ${textStyle("md.comp.filled-text-field.label-text")}!.color?.withOpacity(0.38));
  }
  return TextStyle(color: ${textStyle("md.comp.filled-text-field.label-text")}!.color);
});

19
TextStyle _m3InputStyle(BuildContext context) => ${textStyle("md.comp.filled-text-field.label-text")}!;
20 21

TextStyle _m3CounterErrorStyle(BuildContext context) =>
22
  ${textStyle("md.comp.filled-text-field.supporting-text")}!.copyWith(color: ${componentColor('md.comp.filled-text-field.error.supporting-text')});
23 24
''';
}