Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/flutter_form_bloc/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ class LoadingDialog extends StatelessWidget {

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
return PopScope(
canPop: false,
child: Center(
child: Card(
child: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ class CheckboxFieldBlocBuilder extends StatelessWidget {
final TextStyle? textStyle;

/// {@macro flutter_form_bloc.FieldBlocBuilder.textColor}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

// ========== [Checkbox] ==========

/// [Checkbox.mouseCursor]
final MaterialStateProperty<MouseCursor?>? mouseCursor;
final WidgetStateProperty<MouseCursor?>? mouseCursor;

/// [Checkbox.fillColor]
final MaterialStateProperty<Color?>? fillColor;
final WidgetStateProperty<Color?>? fillColor;

/// [Checkbox.checkColor]
final MaterialStateProperty<Color?>? checkColor;
final WidgetStateProperty<Color?>? checkColor;

/// [Checkbox.overlayColor]
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// [Checkbox.splashRadius]
final double? splashRadius;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DateTimeFieldBlocBuilder extends StatelessWidget {
final TextStyle? textStyle;

/// {@macro flutter_form_bloc.FieldBlocBuilder.textColor}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

final DateTime initialDate;
final DateTime firstDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DateTimeFieldBlocBuilderBase<T> extends StatefulWidget {
/// {@macro flutter_form_bloc.FieldBlocBuilder.style}
final TextStyle? textStyle;

final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

/// Defaults `true`
final bool? showClearIcon;
Expand All @@ -107,7 +107,7 @@ class DateTimeFieldBlocBuilderBase<T> extends StatefulWidget {
final TimeOfDay initialTime;

@override
_DateTimeFieldBlocBuilderBaseState createState() =>
State<DateTimeFieldBlocBuilderBase<T>> createState() =>
_DateTimeFieldBlocBuilderBaseState();

DateTimeFieldTheme themeStyleOf(BuildContext context) {
Expand Down Expand Up @@ -170,7 +170,7 @@ class _DateTimeFieldBlocBuilderBaseState<T>
} else if (widget.type == DateTimeFieldBlocBuilderBaseType.both) {
final date = await _showDatePicker(context);

if (date != null) {
if (date != null && context.mounted) {
final time = await _showTimePicker(context);
result = _combine(date, time);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TimeFieldBlocBuilder extends StatelessWidget {
/// {@macro flutter_form_bloc.FieldBlocBuilder.style}
final TextStyle? textStyle;

final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

final SelectableDayPredicate? selectableDayPredicate;
final DatePickerMode initialDatePickerMode = DatePickerMode.day;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DropdownFieldBlocBuilder<Value> extends StatelessWidget {
final TextStyle? textStyle;

/// {@macro flutter_form_bloc.FieldBlocBuilder.textColor}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

/// Defaults is [TextOverflow.ellipsis]
final TextOverflow? textOverflow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CanShowFieldBlocBuilder extends StatefulWidget {
final Widget Function(BuildContext context, bool canShow) builder;

@override
_CanShowFieldBlocBuilderState createState() =>
State<CanShowFieldBlocBuilder> createState() =>
_CanShowFieldBlocBuilderState();
}

Expand Down
12 changes: 8 additions & 4 deletions packages/flutter_form_bloc/lib/src/flutter_typeahead.dart
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ class TypeAheadField<T> extends StatefulWidget {
super(key: key);

@override
_TypeAheadFieldState<T> createState() => _TypeAheadFieldState<T>();
State<TypeAheadField<T>> createState() => _TypeAheadFieldState<T>();
}

class _TypeAheadFieldState<T> extends State<TypeAheadField<T>>
Expand All @@ -601,6 +601,7 @@ class _TypeAheadFieldState<T> extends State<TypeAheadField<T>>

TextEditingController? get _effectiveController =>
widget.textFieldConfiguration.controller ?? _textEditingController;

FocusNode? get _effectiveFocusNode =>
widget.textFieldConfiguration.focusNode ?? _focusNode;
late VoidCallback _focusNodeListener;
Expand All @@ -609,6 +610,7 @@ class _TypeAheadFieldState<T> extends State<TypeAheadField<T>>

// Timer that resizes the suggestion box on each tick. Only active when the user is scrolling.
Timer? _resizeOnScrollTimer;

// The rate at which the suggestion box will resize when the user is scrolling
final Duration _resizeOnScrollRefreshRate = const Duration(milliseconds: 500);

Expand Down Expand Up @@ -650,6 +652,7 @@ class _TypeAheadFieldState<T> extends State<TypeAheadField<T>>

late final KeyboardVisibilityController keyboardVisibilityController;
late final bool isWebMobile;

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -1281,9 +1284,9 @@ class _SuggestionsListState<T> extends State<_SuggestionsList<T>>

initialItemCount: suggestions.length,

reverse: widget.suggestionsBox!.direction == AxisDirection.down
? false
: true, // reverses the list to start at the bottom
reverse:
widget.suggestionsBox!.direction == AxisDirection.down ? false : true,
// reverses the list to start at the bottom

itemBuilder: buildItem,
);
Expand Down Expand Up @@ -1738,6 +1741,7 @@ class _SuggestionsBox {
timer += 170;

if (widgetMounted &&
context.mounted &&
(MediaQuery.of(context).viewInsets != initial ||
_findRootMediaQuery() != initialRootMediaQuery)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CheckboxGroupFieldBlocBuilder<Value> extends StatelessWidget {
final TextStyle? textStyle;

/// {@macro flutter_form_bloc.FieldBlocBuilder.textColor}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

/// {@macro flutter_form_bloc.FieldBlocBuilder.groupStyle}
final GroupStyle groupStyle;
Expand All @@ -78,16 +78,16 @@ class CheckboxGroupFieldBlocBuilder<Value> extends StatelessWidget {
// ========== [Checkbox] ==========

/// [Checkbox.mouseCursor]
final MaterialStateProperty<MouseCursor?>? mouseCursor;
final WidgetStateProperty<MouseCursor?>? mouseCursor;

/// [Checkbox.fillColor]
final MaterialStateProperty<Color?>? fillColor;
final WidgetStateProperty<Color?>? fillColor;

/// [Checkbox.checkColor]
final MaterialStateProperty<Color?>? checkColor;
final WidgetStateProperty<Color?>? checkColor;

/// [Checkbox.overlayColor]
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// [Checkbox.splashRadius]
final double? splashRadius;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RadioButtonGroupFieldBlocBuilder<Value> extends StatelessWidget {
final TextStyle? textStyle;

/// {@macro flutter_form_bloc.FieldBlocBuilder.textColor}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

/// {@macro flutter_form_bloc.FieldBlocBuilder.groupStyle}
final GroupStyle groupStyle;
Expand All @@ -81,13 +81,13 @@ class RadioButtonGroupFieldBlocBuilder<Value> extends StatelessWidget {
// ========== [Radio] ==========

/// [Radio.mouseCursor]
final MaterialStateProperty<MouseCursor?>? mouseCursor;
final WidgetStateProperty<MouseCursor?>? mouseCursor;

/// [Radio.fillColor]
final MaterialStateProperty<Color?>? fillColor;
final WidgetStateProperty<Color?>? fillColor;

/// [Radio.overlayColor]
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// [Radio.splashRadius]
final double? splashRadius;
Expand Down
20 changes: 10 additions & 10 deletions packages/flutter_form_bloc/lib/src/stepper/stepper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
} else {
return widget.steps[index].isActive
? colorScheme.secondary
: colorScheme.background;
: colorScheme.surface;
}
}

Expand Down Expand Up @@ -463,23 +463,23 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
TextButton(
onPressed: widget.onStepContinue,
style: ButtonStyle(
foregroundColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
return states.contains(MaterialState.disabled)
foregroundColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
return states.contains(WidgetState.disabled)
? null
: (_isDark()
? colorScheme.onSurface
: colorScheme.onPrimary);
}),
backgroundColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
return _isDark() || states.contains(MaterialState.disabled)
backgroundColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
return _isDark() || states.contains(WidgetState.disabled)
? null
: colorScheme.primary;
}),
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
buttonPadding),
shape: MaterialStateProperty.all<OutlinedBorder>(buttonShape),
padding:
WidgetStateProperty.all<EdgeInsetsGeometry>(buttonPadding),
shape: WidgetStateProperty.all<OutlinedBorder>(buttonShape),
),
child: Text(localizations.continueButtonLabel),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SwitchFieldBlocBuilder extends StatelessWidget {
final bool animateWhenCanShow;

final TextStyle? textStyle;
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

// ========== [Switch] ==========

Expand All @@ -86,19 +86,19 @@ class SwitchFieldBlocBuilder extends StatelessWidget {
final ImageProvider? inactiveThumbImage;

/// [Switch.thumbColor]
final MaterialStateProperty<Color?>? thumbColor;
final WidgetStateProperty<Color?>? thumbColor;

/// [Switch.trackColor]
final MaterialStateProperty<Color?>? trackColor;
final WidgetStateProperty<Color?>? trackColor;

/// [Switch.materialTapTargetSize]
final MaterialTapTargetSize? materialTapTargetSize;

/// [Switch.mouseCursor]
final MaterialStateProperty<MouseCursor?>? mouseCursor;
final WidgetStateProperty<MouseCursor?>? mouseCursor;

/// [Switch.overlayColor]
final MaterialStateProperty<Color?>? overlayColor;
final WidgetStateProperty<Color?>? overlayColor;

/// [Switch.splashRadius]
final double? splashRadius;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@ class TextFieldBlocBuilder extends StatefulWidget {
/// {@template flutter_form_bloc.FieldBlocBuilder.textColor}
/// It is the color of the text
///
/// You can receive this state: [MaterialState.disabled]
/// You can receive this state: [WidgetState.disabled]
/// {@endtemplate}
final MaterialStateProperty<Color?>? textColor;
final WidgetStateProperty<Color?>? textColor;

/// {@macro flutter.widgets.editableText.strutStyle}
final StrutStyle? strutStyle;
Expand Down Expand Up @@ -732,7 +732,7 @@ class TextFieldBlocBuilder extends StatefulWidget {
}

@override
_TextFieldBlocBuilderState createState() => _TextFieldBlocBuilderState();
State<TextFieldBlocBuilder> createState() => _TextFieldBlocBuilderState();
}

class _TextFieldBlocBuilderState extends State<TextFieldBlocBuilder> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FieldThemeResolver {
InputDecorationTheme get decorationTheme {
return fieldTheme?.decorationTheme ??
formTheme.decorationTheme ??
theme.inputDecorationTheme;
InputDecorationTheme(data: theme.inputDecorationTheme);
}

TextStyle get textStyle {
Expand All @@ -24,10 +24,10 @@ class FieldThemeResolver {
theme.textTheme.titleMedium!;
}

MaterialStateProperty<Color?> get textColor {
WidgetStateProperty<Color?> get textColor {
return fieldTheme?.textColor ??
formTheme.textColor ??
SimpleMaterialStateProperty(
SimpleWidgetStateProperty(
normal: theme.textTheme.titleMedium!.color,
disabled: theme.disabledColor,
);
Expand All @@ -41,8 +41,8 @@ abstract class FieldTheme extends Equatable {
final TextStyle? textStyle;

/// Resolves the color of the [textStyle].
/// You will receive [MaterialState.disabled]
final MaterialStateProperty<Color?>? textColor;
/// You will receive [WidgetState.disabled]
final WidgetStateProperty<Color?>? textColor;

/// The theme for InputDecoration of this field
final InputDecorationTheme? decorationTheme;
Expand Down
Loading