Skip to content
Open
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ linter:
- only_throw_errors
# in some places it is required to override fields
# - overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:getwidget/getwidget.dart';
import 'package:url_launcher/url_launcher.dart';

void main() => runApp(MyApp());

Expand Down
2 changes: 1 addition & 1 deletion lib/components/alert/gf_alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
boxShadow: widget.shadow ??
[
BoxShadow(
color: Colors.black87.withOpacity(0.1),
color: Colors.black87.withValues(alpha: 0.1),
offset: const Offset(0, 1),
blurRadius: 10,
spreadRadius: 2,
Expand Down
18 changes: 9 additions & 9 deletions lib/components/appbar/gf_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
///
/// The value is non-negative.
///
/// If this property is null, then [ThemeData.appBarTheme.elevation] is used,
/// If this property is null, then [AppBarTheme.elevation] is used,
/// if that is also null, the default value is 4, the appropriate elevation
/// for app bars.
final double? elevation;
Expand All @@ -123,14 +123,14 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
/// The color to use for the app bar's material. Typically this should be set
/// along with [brightness], [iconTheme], [textTheme].
///
/// If this property is null, then [ThemeData.appBarTheme.color] is used,
/// If this property is null, then [AppBarTheme.backgroundColor] is used,
/// if that is also null, then [ThemeData.primaryColor] is used.
final Color? backgroundColor;

/// The brightness of the app bar's material. Typically this is set along
/// with [backgroundColor], [iconTheme], [textTheme].
///
/// If this property is null, then [ThemeData.appBarTheme.brightness] is used,
/// If this property is null, then [ThemeData.brightness] is used,
/// if that is also null, then the appBarTheme can be used to configure the
/// appearance of AppBars. The appearance of Keyboards for TextFields now uses
/// the overall theme's ThemeData.brightness and can also be customized with
Expand All @@ -141,7 +141,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
/// The color, opacity, and size to use for app bar icons. Typically this
/// is set along with [backgroundColor], [brightness], [textTheme].
///
/// If this property is null, then [ThemeData.appBarTheme.iconTheme] is used,
/// If this property is null, then [AppBarTheme.iconTheme] is used,
/// if that is also null, then [ThemeData.primaryIconTheme] is used.
final IconThemeData? iconTheme;

Expand All @@ -150,14 +150,14 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
/// themed differently than the icon that appears in the app bar's [leading]
/// widget.
///
/// If this property is null, then [ThemeData.appBarTheme.actionsIconTheme] is
/// If this property is null, then [AppBarTheme.actionsIconTheme] is
/// used, if that is also null, then this falls back to [iconTheme].
final IconThemeData? actionsIconTheme;

/// The typographic styles to use for text in the app bar. Typically this is
/// set along with [brightness] [backgroundColor], [iconTheme].
///
/// If this property is null, then [ThemeData.appBarTheme.textTheme] is used,
/// If this property is null, then [ThemeData.textTheme] is used,
/// if that is also null, then [ThemeData.primaryTextTheme] is used.
final TextTheme? textTheme;

Expand Down Expand Up @@ -226,7 +226,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
///
/// * inputFormatters, which are called before [onChanged]
/// runs and can validate and change ("format") the input value.
/// * onEditingComplete, [onSubmitted], [onSelectionChanged]:
/// * onEditingComplete, [onSubmitted]:
/// which are more specialized input change notifications.
final ValueChanged<String>? onChanged;

Expand Down Expand Up @@ -333,12 +333,12 @@ class _GFAppBarState extends State<GFAppBar> {
).transform(widget.toolbarOpacity);
if (centerStyle?.color != null) {
centerStyle = centerStyle!.copyWith(
color: centerStyle.color!.withOpacity(opacity),
color: centerStyle.color!.withValues(alpha: opacity),
);
}
if (sideStyle?.color != null) {
sideStyle = sideStyle!.copyWith(
color: sideStyle.color!.withOpacity(opacity),
color: sideStyle.color!.withValues(alpha: opacity),
);
}
overallIconTheme = overallIconTheme.copyWith(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/avatar/gf_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class GFAvatar extends StatelessWidget {
? null
: Center(
child: MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
data: MediaQuery.of(context)
.copyWith(textScaler: const TextScaler.linear(1)),
child: IconTheme(
data: theme.iconTheme.copyWith(color: textStyle?.color),
child: DefaultTextStyle(
Expand Down
1 change: 0 additions & 1 deletion lib/components/badge/gf_button_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ class GFButtonBadge extends StatefulWidget {
/// The color to use for this badge's text when the badge is disabled.
///
/// The badge's [Material.textStyle] will be the current theme's badge
/// text style, [ThemeData.textTheme.badge], configured with this color.
///
/// The default value is the theme's disabled color,
/// [ThemeData.disabledColor].
Expand Down
35 changes: 17 additions & 18 deletions lib/components/button/gf_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ class GFButton extends StatefulWidget {
/// The color to use for this button's text when the button is disabled.
///
/// The button's [Material.textStyle] will be the current theme's button
/// text style, [ThemeData.textTheme.button], configured with this color.
///
/// The default value is the theme's disabled color,
/// [ThemeData.disabledColor].
Expand Down Expand Up @@ -235,7 +234,7 @@ class _GFButtonState extends State<GFButton> {
late GFPosition position;
late BoxShadow boxShadow;

final Set<MaterialState> _states = <MaterialState>{};
final Set<WidgetState> _states = <WidgetState>{};

@override
void initState() {
Expand All @@ -251,16 +250,16 @@ class _GFButtonState extends State<GFButton> {
disabledColor = widget.disabledColor;
disabledTextColor = widget.disabledTextColor;
_updateState(
MaterialState.disabled,
WidgetState.disabled,
!widget.enabled,
);
super.initState();
}

bool get _hovered => _states.contains(MaterialState.hovered);
bool get _focused => _states.contains(MaterialState.focused);
bool get _pressed => _states.contains(MaterialState.pressed);
bool get _disabled => _states.contains(MaterialState.disabled);
bool get _hovered => _states.contains(WidgetState.hovered);
bool get _focused => _states.contains(WidgetState.focused);
bool get _pressed => _states.contains(WidgetState.pressed);
bool get _disabled => _states.contains(WidgetState.disabled);

double? buttonWidth() {
double? buttonWidth = 0;
Expand All @@ -274,14 +273,14 @@ class _GFButtonState extends State<GFButton> {
return buttonWidth;
}

void _updateState(MaterialState state, bool value) {
void _updateState(WidgetState state, bool value) {
value ? _states.add(state) : _states.remove(state);
}

void _handleHighlightChanged(bool value) {
if (_pressed != value) {
setState(() {
_updateState(MaterialState.pressed, value);
_updateState(WidgetState.pressed, value);
if (widget.onHighlightChanged != null) {
widget.onHighlightChanged!(value);
}
Expand All @@ -292,22 +291,22 @@ class _GFButtonState extends State<GFButton> {
void _handleHoveredChanged(bool value) {
if (_hovered != value) {
setState(() {
_updateState(MaterialState.hovered, value);
_updateState(WidgetState.hovered, value);
});
}
}

void _handleFocusedChanged(bool value) {
if (_focused != value) {
setState(() {
_updateState(MaterialState.focused, value);
_updateState(WidgetState.focused, value);
});
}
}

@override
void didUpdateWidget(GFButton oldWidget) {
_updateState(MaterialState.disabled, !widget.enabled);
_updateState(WidgetState.disabled, !widget.enabled);
// If the button is disabled while a press gesture is currently ongoing,
// InkWell makes a call to handleHighlightChanged. This causes an exception
// because it calls setState in the middle of a build. To preempt this, we
Expand All @@ -327,7 +326,7 @@ class _GFButtonState extends State<GFButton> {
disabledColor = widget.disabledColor;
disabledTextColor = widget.disabledTextColor;
_updateState(
MaterialState.disabled,
WidgetState.disabled,
!widget.enabled,
);
super.didUpdateWidget(oldWidget);
Expand Down Expand Up @@ -363,7 +362,7 @@ class _GFButtonState extends State<GFButton> {
if (disabledColor != null) {
return disabledColor!;
} else {
return color.withOpacity(0.48);
return color.withValues(alpha: 0.48);
}
}
}
Expand All @@ -377,7 +376,7 @@ class _GFButtonState extends State<GFButton> {
if (disabledColor != null) {
return disabledColor!;
} else {
return color.withOpacity(0.48);
return color.withValues(alpha: 0.48);
}
}

Expand Down Expand Up @@ -426,10 +425,10 @@ class _GFButtonState extends State<GFButton> {
}
}

final Color? effectiveTextColor = MaterialStateProperty.resolveAs<Color?>(
widget.textStyle?.color, _states);
final Color? effectiveTextColor =
WidgetStateProperty.resolveAs<Color?>(widget.textStyle?.color, _states);
final Color themeColor =
Theme.of(context).colorScheme.onSurface.withOpacity(0.12);
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.12);
final BorderSide outlineBorder = BorderSide(
color: widget.borderSide == null
? getBorderColor()
Expand Down
8 changes: 4 additions & 4 deletions lib/components/button/gf_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _GFIconButtonState extends State<GFIconButton> {
if (widget.disabledColor != null) {
return widget.disabledColor!;
} else {
return color.withOpacity(0.48);
return color.withValues(alpha: 0.48);
}
}
}
Expand All @@ -136,7 +136,7 @@ class _GFIconButtonState extends State<GFIconButton> {
if (widget.disabledColor != null) {
return widget.disabledColor;
} else {
return color.withOpacity(0.48);
return color.withValues(alpha: 0.48);
}
}

Expand All @@ -158,7 +158,7 @@ class _GFIconButtonState extends State<GFIconButton> {
? color == GFColors.TRANSPARENT
? GFColors.DARK
: color
: color.withOpacity(0.48);
: color.withValues(alpha: 0.48);
} else if (color == GFColors.TRANSPARENT) {
return widget.onPressed != null ? GFColors.DARK : GFColors.WHITE;
} else {
Expand All @@ -171,7 +171,7 @@ class _GFIconButtonState extends State<GFIconButton> {
assert(debugCheckHasMaterial(context));

final Color themeColor =
Theme.of(context).colorScheme.onSurface.withOpacity(0.12);
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.12);
final BorderSide outlineBorder = BorderSide(
color: widget.borderSide == null
? getBorderColor()
Expand Down
2 changes: 1 addition & 1 deletion lib/components/card/gf_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class GFCard extends StatelessWidget {
/// Whether to paint the [shape] border in front of the child.
final bool borderOnForeground;

/// If this property is null then [ThemeData.cardTheme.clipBehavior] is used.
/// If this property is null then [CardTheme.clipBehavior] is used.
final Clip? clipBehavior;

/// The empty space that surrounds the card. Defines the card's outer [Container.margin].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class _GfFormDropDownState extends State<GfFormDropDown> {
padding: widget.padding ??
const EdgeInsets.symmetric(vertical: 2, horizontal: 2),
child: DropdownButtonFormField<String>(
value: selectedValue,
initialValue: selectedValue,
decoration: GfFormFieldDecoration(
context: context,
shape: GFTextFieldShape.roundedsquare,
Expand Down
84 changes: 39 additions & 45 deletions lib/components/form/form_field/widgets/gf_formradiobutton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,61 +42,55 @@ class _GfFormGenderbuttonState extends State<GfFormGenderbutton>
builder: (context, child) {
selectedValue = dataModel.selectedValue;
return Card(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
onTap: () {
selectedValue = 'Male';
widget.onChanged(selectedValue);
dataModel.setValue(selectedValue.toString());
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Radio(
value: 'Male',
groupValue: selectedValue,
onChanged: (String? val) {
if (val != null && val.isNotEmpty) {
selectedValue = val.toString();
widget.onChanged(selectedValue);
dataModel.setValue(val.toString());
}
},
),
const SizedBox(
width: 8,
),
const Text('Male')
]),
),
InkWell(
child: RadioGroup(
onChanged: (String? val) {
setState(() {
selectedValue = val.toString();
widget.onChanged(selectedValue);
dataModel.setValue(selectedValue.toString());
});
},
groupValue: selectedValue,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
onTap: () {
selectedValue = 'Female';
selectedValue = 'Male';
widget.onChanged(selectedValue);
dataModel.setValue(selectedValue.toString());
},
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Radio(
value: 'Female',
groupValue: selectedValue,
onChanged: (String? val) {
if (val != null && val.isNotEmpty) {
selectedValue = val.toString();
widget.onChanged(selectedValue);
dataModel.setValue(val.toString());
}
},
value: 'Male',
),
const SizedBox(
SizedBox(
width: 8,
),
const Text('Female')
])),
],
Text('Male')
]),
),
InkWell(
onTap: () {
selectedValue = 'Female';
widget.onChanged(selectedValue);
dataModel.setValue(selectedValue.toString());
},
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Radio(
value: 'Female',
),
SizedBox(
width: 8,
),
Text('Female')
])),
],
),
));
}),
);
Expand Down
Loading