Sponsored by MyText.ai
- Breaking change: The signature of the builders of
TimeBuilder
have been changed. They all now use named parameters, and also get a newinitialTime
parameter that was not present before. Migration should be straightforward, Refer to the README for more information.
- The
ScrollShadow
widget adds a shadow at the top and/or bottom, to scrollables likeSingleChildScrollView
orListView
etc., when the content doesn't fit the scrollable's viewport. As the shadow appears only if there is content outside the viewable area, this gives the user an indication if there is more content to be seen or not.
-
The
DetectScroll
widget can detect if the content of a Scrollable is larger than the Scrollable itself, which means that the content can be scrolled, and that a scrollbar is likely visible. It can also tell you the probable width of that scrollbar.This is useful for positioning widgets relative to the scrollbar, so that the scrollbar doesn't overlap them. This can be important when the scrollbar is permanently visible, usually on the Web and desktop.
Note that
DetectScroll
will only detect the scrolling of its closest scrollable descendant (a scrollable is aSingleChildScrollView
,ListView
,GridView
etc). Usually, you'd wrap the scrollable you care about directly with aDetectScroll
. For example:DetectScroll( child: SingleChildScrollView( child: Column( ... ... );
To get the current scroll state and the scrollbar width, descendants can call:
bool canScroll = DetectScroll.of(context).canScroll; double scrollbarWidth = DetectScroll.of(context).scrollbarWidth;
For example, suppose you want to add a help button to the top-right corner of a scrollable, and account for the scrollbar width only if it's visible:
bool canScroll = DetectScroll.of(context).canScroll; double scrollbarWidth = DetectScroll.of(context).scrollbarWidth; return Stack( children: [ child, Positioned( right: canScroll ? scrollbarWidth : 0, top: 0, child: HelpButton(), ), ], );
Another alternative is using the optional
onChange
callback of theDetectScroll
:DetectScroll( onChange: ({ required bool canScroll, required double scrollbarWidth, }) { // Do something. } child: ... ),
- The
SideBySide
widget now has amainAxisSize
property the determines whether it will occupy the full available width (MainAxisSize.max
) or only as much as it needs (MainAxisSize.min
).
-
CircleButton
now accepts an optional custom builder function to modify the button's child widget. This can be used to animate the button when the button is tapped, or when the mouse is over it. For example:CircleButton( icon: Icon(Icons.shopping_cart), builder: ({ required bool isHover, required bool isPressed, required Widget child, }) => AnimatedScale( scale: isPressed ? 0.85 : 1.0, duration: const Duration(milliseconds: 50), child: child, ), );
Try running the example.
-
SideBySide
widget now allows for any number of children, not just two. Example:SideBySide( children: [ Text("Hello!", textWidthBasis: TextWidthBasis.longestLine), Text("How are you?", textWidthBasis: TextWidthBasis.longestLine), Text("I'm good, thank you.", textWidthBasis: TextWidthBasis.longestLine), ], gaps: [8.0, 12.0], );
The
SideBySide
widget achieves layouts that are not possible withRow
orRowSuper
widgets. Read the documentation for more information.Deprecated usage: The
startChild
andendChild
parameters are deprecated. Use thechildren
parameter instead. TheinnerDistance
parameter is also deprecated. Use thegaps
parameter instead.For example, this deprecated code:
return SideBySide( startChild: Text("Hello!", textWidthBasis: TextWidthBasis.longestLine), endChild: Text("How are you?", textWidthBasis: TextWidthBasis.longestLine), innerDistance: 8.0, );
Should be replaced with:
return SideBySide( children: [ Text("Hello!", textWidthBasis: TextWidthBasis.longestLine), Text("How are you?", textWidthBasis: TextWidthBasis.longestLine), ], gaps: [8.0], );
-
The
Box
widget can now have adecoration
, as well as adecorationPosition
. Previously, if aContainer
had a decoration you could not replace it with aBox
, but now you can. Note theBox
is a little more flexible than theContainer
when you define acolor
and aBoxDecoration
or aShapeDecoration
at the same time, as theBox
will only throw an error if thecolor
is defined twice. -
You can use
Box.gap()
to create a small gap between widgets:Column( children: [ Text('A'), const Box.gap(8), // 8.0 pixel gap Text('B'), ]);
- Fixed
GestureDetector
ordering issue forRowSuper
andColumnSuper
when theinvert
param istrue
.
-
Removed
KeyboardDismiss
dependency ondart:io
to make it compatible with platform web. -
Now
CircleButton
can specifyhoverColor
(default is no color), andcursor
(the default isSystemMouseCursors.click
, but you can passnull
to set it asMouseCursor.defer
.
- Added
Pad.addValues
andPad.subtractValues
.
- Flutter 3.16.0 compatible.
- const WrapSuper.
- Removed deprecated
TextOneLineEllipsisWithFade
widget. Please useTextOneLine
instead.
- Fixed letter-spacing for TextOneLine, whe the style is defined inline.
-
Flutter 3.3.0 (Dart 2.18.0).
-
TextOneLineEllipsisWithFade
deprecated. Please useTextOneLine
instead.
KeyboardDismiss
.
- Flutter 3.0.
NonUniformOutlineInputBorder
andNonUniformRoundedRectangleBorder
widgets.
CaptureGestures
widget.
Button
andCircleButton
widgets.
SideBySide
widget.
MaskFunctionTextInputFormatter
input formatter (forText
widgets).
ColumnSuper
parameter:removeChildrenWithNoHeight
. See this example.
GlobalValueKey
andGlobalStringKey
.
- Upgrade to Flutter 2.5.1
- Fixed alignment bug in
RowSuper
whenfill: true
andMainAxisSize.max
andAlignment.center
.
TimeBuilder
widget.
-
Box.copyWith()
method. -
Now
Box
can be changed by using theoperator +
. For example, to hide the box:Box(...) + false;
. To change the box color:Box(...) + Colors.green;
. To change the box padding:Box(...) + Pad(all: 10);
. To substitute the box child:Box(...) + Text('abc');
. To put a box inside of another:Box(...) + Box(...);
.
- Now
TextOneLine
is more similar to the nativeText
widget, in preparation for when flutter/flutter#18761 is fixed. You probably won't notice the difference and may continue using it as usual.
-
showCupertinoDialogSuper
. -
The
onDismissed
callback parameter forshowDialogSuper
is called when the dialog is dismissed. That's still the case, but now that callback gets theresult
of the dialog, when the dialog is popped byNavigator.of(context).pop(result)
. That way you can differentiate between the dialog being dismissed by an Ok or a Cancel button, for example. Noteresult
isnull
when the dialog is dismissed by tapping the barrier or pressing BACK in Android. Example:showDialogSuper<int>( ... actions: [ ElevatedButton( onPressed: (){Navigator.pop(context, 1);}, child: const Text("OK"), ElevatedButton( onPressed: (){Navigator.pop(context, 2);}, child: const Text("CANCEL"), ] ... onDismissed: (int? result) { if (result == 1) print("Pressed the OK button."); else if (result == 2) print("Pressed the CANCEL button."); else if (result == null) print("Dismissed with BACK or tapping the barrier."); });
- Fixed bug in
WrapSuper
intrinsic height.
showDialogSuper
method is identical to the nativeshowDialog
, except that it lets you define a callback for when the dialog is dismissed.
- Fixed important bug in
FitHorizontally
widget (andRowSuper
when using thefitHorizontally
parameter).
NormalizedOverflowBox
widget.
WrapSuper.wrapFit
parameter.ButtonBarSuper
parameter.- New examples: WrapSuper WrapFit Example and ButtonBarSuper Example
Pad.copyWith()
.
- Fixed NNBD problem:
TextOneLine
as child of an intrinsic size widget.
- Nullsafety.
RowSuper
horizontal alignment now applied when there are noRowSpacer
s andMainAxisSize
ismax
.
-
Breaking change: The
Box
widget now has apadding
parameter. I recommend you use it with the newPad
class. For example:Box(padding: Pad(top: 4.0))
. ThePad
class solves the verbosity problem, and having apadding
parameter makesBox
more compatible withContainer
( rememberBox
is like aContainer
which can be madeconst
, so it's best if their parameters are not too different). -
The debugging constructors of the
Box
widget are now marked as deprecated so that you don't forget to remove them (they are not really deprecated).
Pad
class.
- Support for Flutter 1.22.
- Docs improvement.
- Fixed edge case for
RowSuper
.
- Docs improvement.
- RowSuper:
fill
parameter.
Delayed
widget.
- Breaking Change:
ColumnSuper
width is now the max intrinsic width of its children, just like a regularColumn
. To restore old behavior:Container(width: double.infinity, child: ColumnSuper(...))
. - Breaking Change:
RowSuper
height is now the max intrinsic height of its children, just like a regularRow
. To restore old behavior:Container(height: double.infinity, child: RowSuper(...))
. - New examples: ColumnSuper Playground and RowSuper Playground.
- Fix:
ColumnSuper
intrinsic height, andRowSuper
intrinsic width.
- Fix:
WrapSuper
minimum raggedness algorithm now uses the correct JavaScript'sNumber.MAX_SAFE_INTEGER
. - Fix: Divide by zero conditions.
- Docs improvement.
- Upgraded to Flutter 1.17.
WrapSuper
.
- Box now has
vertical
andhorizontal
as constructor parameters.
TextOneLine
that fixes flutter/flutter#18761.
- Alignment fix.
Box
.
FitHorizontally
widget.RowSpacer
widget.
RowSuper
andColumnSuper
widgets.