stack_wallet/lib/widgets/stack_text_field.dart

42 lines
1.5 KiB
Dart
Raw Normal View History

2022-08-26 08:11:35 +00:00
import 'package:flutter/material.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
2022-09-19 20:18:31 +00:00
import 'package:stackwallet/utilities/util.dart';
2022-08-26 08:11:35 +00:00
InputDecoration standardInputDecoration(
2022-10-27 16:51:56 +00:00
String? labelText,
FocusNode textFieldFocusNode,
BuildContext context, {
bool desktopMed = false,
}) {
2022-09-19 20:18:31 +00:00
final isDesktop = Util.isDesktop;
2022-08-26 08:11:35 +00:00
return InputDecoration(
labelText: labelText,
fillColor: textFieldFocusNode.hasFocus
? Theme.of(context).extension<StackColors>()!.textFieldActiveBG
: Theme.of(context).extension<StackColors>()!.textFieldDefaultBG,
2022-09-22 22:17:21 +00:00
labelStyle: isDesktop
2022-10-27 16:51:56 +00:00
? desktopMed
? STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultText)
: STextStyles.desktopTextFieldLabel(context)
2022-09-22 22:17:21 +00:00
: STextStyles.fieldLabel(context),
hintStyle: isDesktop
2022-10-27 16:51:56 +00:00
? desktopMed
? STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultText)
: STextStyles.desktopTextFieldLabel(context)
2022-09-22 22:17:21 +00:00
: STextStyles.fieldLabel(context),
2022-08-26 08:11:35 +00:00
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
);
}