diff --git a/example/lib/main.dart b/example/lib/main.dart index da5f922..706a327 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -17,8 +17,8 @@ class App extends StatelessWidget { primaryColor: const Color(0xFF37393d), scaffoldBackgroundColor: Colors.grey[100], textTheme: const TextTheme( - bodyText1: TextStyle(color: Colors.white), - headline4: TextStyle( + bodyLarge: TextStyle(color: Colors.white), + headlineMedium: TextStyle( color: Colors.black, fontSize: 30, fontWeight: FontWeight.bold, diff --git a/example/pubspec.lock b/example/pubspec.lock index eab52ef..0ea2abf 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,49 +5,56 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.8" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -67,34 +74,62 @@ packages: relative: true source: path version: "1.2.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.12.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -104,51 +139,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.7.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=1.17.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 51c8873..826d60d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,8 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: diff --git a/lib/helpers.dart b/lib/helpers.dart index 5984d56..d43b4e7 100644 --- a/lib/helpers.dart +++ b/lib/helpers.dart @@ -1,4 +1,3 @@ -library helpers; export 'package:helpers/helpers/curves.dart'; export 'package:helpers/helpers/decorations.dart'; diff --git a/lib/helpers/decorations.dart b/lib/helpers/decorations.dart index 98d90da..915edb1 100644 --- a/lib/helpers/decorations.dart +++ b/lib/helpers/decorations.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; class NoneInputDecoration extends InputDecoration { - const NoneInputDecoration({String? hintText, TextStyle? hintStyle}) + const NoneInputDecoration({super.hintText, super.hintStyle}) : super( - hintText: hintText, - hintStyle: hintStyle, border: InputBorder.none, errorBorder: InputBorder.none, focusedBorder: InputBorder.none, diff --git a/lib/helpers/extensions/string.dart b/lib/helpers/extensions/string.dart index 6e0bc5a..6f3c20d 100644 --- a/lib/helpers/extensions/string.dart +++ b/lib/helpers/extensions/string.dart @@ -67,7 +67,7 @@ extension StringHelperExtension on String { asterisks.forEach((_) => censor.write("*")); if (count >= begin + end) { - return "${substring(0, begin)}${censor.toString()}${substring(count - end, count)}"; + return "${substring(0, begin)}$censor${substring(count - end, count)}"; } return this; } diff --git a/lib/helpers/lists/list_differences.dart b/lib/helpers/lists/list_differences.dart index a5a2544..48f90e9 100644 --- a/lib/helpers/lists/list_differences.dart +++ b/lib/helpers/lists/list_differences.dart @@ -7,23 +7,23 @@ class ListDifference { List currentValues = const [], this.containsValidator, }) { - final List _initial = initialValues.removeDuplicates(); - final List _current = currentValues.removeDuplicates(); + final List initial = initialValues.removeDuplicates(); + final List current = currentValues.removeDuplicates(); - if (!listEquals(_initial, _current)) { - if (_initial.isEmpty) { - added.addAll(_current); + if (!listEquals(initial, current)) { + if (initial.isEmpty) { + added.addAll(current); } else { - for (final item in _initial) { - if (!_validator(_current, item)) removed.add(item); + for (final item in initial) { + if (!_validator(current, item)) removed.add(item); } - for (final item in _current) { - if (!_validator(_initial, item)) added.add(item); + for (final item in current) { + if (!_validator(initial, item)) added.add(item); } } equals.addAll(currentValues.where((e) => _validator(initialValues, e))); } else { - equals.addAll(_current); + equals.addAll(current); } } diff --git a/lib/helpers/misc.dart b/lib/helpers/misc.dart index 46c4d23..43a9f85 100644 --- a/lib/helpers/misc.dart +++ b/lib/helpers/misc.dart @@ -48,9 +48,8 @@ class Misc { ///adipiscing elit, sed do eiusmod tempor incididunt ///ut labore et dolore magna aliqua." ///``` - static const String loremIpsum = - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + - "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; + static const String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; static BigInt maxInt = BigInt.parse("9223372036854775807"); @@ -65,8 +64,7 @@ class Misc { static bool isPhoneNumber(String text) { if (text.length > 16 || text.length < 9) return false; - return RegExp(r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$') - .hasMatch(text); + return RegExp(r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$').hasMatch(text); } static RegExp beetweenCharacterPattern([String character = "*"]) { @@ -112,23 +110,23 @@ class Misc { } static Future widgetToImageBytes({ + required BuildContext context, required Widget child, Size? size, double? pixelRatio, ui.ImageByteFormat format = ui.ImageByteFormat.png, Duration delay = Duration.zero, - BuildContext? context, }) async { final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary(); final PipelineOwner pipelineOwner = PipelineOwner(); - final Size logicalSize = - size ?? ui.window.physicalSize / ui.window.devicePixelRatio; + final Size logicalSize = size ?? View.of(context).physicalSize / View.of(context).devicePixelRatio; final RenderView renderView = RenderView( child: RenderPositionedBox(child: repaintBoundary), configuration: ViewConfiguration( - size: logicalSize, + logicalConstraints: BoxConstraints(maxWidth: logicalSize.width,maxHeight: logicalSize.height), devicePixelRatio: pixelRatio ?? 1.0, ), + view: View.of(context), ); int retryCounter = 3; @@ -144,18 +142,16 @@ class Misc { container: repaintBoundary, child: Directionality( textDirection: TextDirection.ltr, - child: context != null - ? InheritedTheme.captureAll( - context, - MediaQuery(data: MediaQuery.of(context), child: child), - ) - : child, + child: InheritedTheme.captureAll( + context, + MediaQuery(data: MediaQuery.of(context), child: child), + ), ), ).attachToRenderTree(buildOwner); pipelineOwner.rootNode = renderView; renderView.prepareInitialFrame(); - + final physicalSizeWidth = View.of(context).physicalSize.width; void buildScope() { buildOwner ..buildScope(rootElement) @@ -170,9 +166,9 @@ class Misc { do { isDirty = false; + image = await repaintBoundary.toImage( - pixelRatio: - pixelRatio ?? (ui.window.physicalSize.width / logicalSize.width), + pixelRatio: pixelRatio ?? (physicalSizeWidth / logicalSize.width), ); await Future.delayed(delay); if (isDirty) buildScope(); @@ -182,15 +178,13 @@ class Misc { return byteData!.buffer.asUint8List(); } - static bool isUsername(String text) => - RegExp(r'^[a-zA-Z0-9][a-zA-Z0-9_.]+[a-zA-Z0-9]$').hasMatch(text); + static bool isUsername(String text) => RegExp(r'^[a-zA-Z0-9][a-zA-Z0-9_.]+[a-zA-Z0-9]$').hasMatch(text); static bool isUrl(String text) => RegExp( r"^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$") .hasMatch(text); - static bool isBase64(String text) => - RegExp(r"^[-A-Za-z0-9+=]{1,50}|=[^=]|={3,}$").hasMatch(text); + static bool isBase64(String text) => RegExp(r"^[-A-Za-z0-9+=]{1,50}|=[^=]|={3,}$").hasMatch(text); static double pow(double x, int exponent) { return math.pow(x, exponent).toDouble(); @@ -293,11 +287,9 @@ class Misc { return []; } - static bool listEquals(List? a, List? b) => - foundation.listEquals(a, b); + static bool listEquals(List? a, List? b) => foundation.listEquals(a, b); - static bool mapEquals(Map? a, Map? b) => - foundation.mapEquals(a, b); + static bool mapEquals(Map? a, Map? b) => foundation.mapEquals(a, b); static bool hasMapDifference( Map initialMap, @@ -362,8 +354,7 @@ class Misc { printAmber("Completed in ${ms / 1000} seconds", prefix: _prefix ?? ""); } - Duration get elapsed => - DateTime.now().toUtc().difference(_init ?? DateTime.now().toUtc()); + Duration get elapsed => DateTime.now().toUtc().difference(_init ?? DateTime.now().toUtc()); static double lerpDouble(num a, num b, double t) { return ui.lerpDouble(a, b, t)!; @@ -460,8 +451,7 @@ class Misc { ///```dart ///await SystemChrome.setPreferredOrientations(orientations) ///``` - static Future setSystemOrientation( - List orientations) async { + static Future setSystemOrientation(List orientations) async { await SystemChrome.setPreferredOrientations(orientations); } @@ -525,23 +515,17 @@ abstract class SystemOrientation { ///```dart ///return [DeviceOrientation.landscapeLeft] ///``` - static List landscapeLeft = [ - DeviceOrientation.landscapeLeft - ]; + static List landscapeLeft = [DeviceOrientation.landscapeLeft]; ///```dart ///return [DeviceOrientation.landscapeRight] ///``` - static List landscapeRight = [ - DeviceOrientation.landscapeRight - ]; + static List landscapeRight = [DeviceOrientation.landscapeRight]; ///```dart ///return [DeviceOrientation.portraitDown] ///``` - static List portraitDown = [ - DeviceOrientation.portraitDown - ]; + static List portraitDown = [DeviceOrientation.portraitDown]; ///```dart ///return [DeviceOrientation.portraitUp] diff --git a/lib/helpers/misc_build/build_color.dart b/lib/helpers/misc_build/build_color.dart index cb05d30..cc81b4a 100644 --- a/lib/helpers/misc_build/build_color.dart +++ b/lib/helpers/misc_build/build_color.dart @@ -47,11 +47,6 @@ class BuildColor { ///``` Color get scaffold => Theme.of(_context).scaffoldBackgroundColor; - ///```dart - ///return Theme.of(context).bottomAppBarColor - ///``` - Color get bottomAppBar => Theme.of(_context).bottomAppBarColor; - ///```dart ///return Theme.of(context).cardColor ///``` @@ -82,11 +77,6 @@ class BuildColor { ///``` Color get splash => Theme.of(_context).splashColor; - ///```dart - ///return Theme.of(context).selectedRowColor - ///``` - Color get selectedRow => Theme.of(_context).selectedRowColor; - ///```dart ///return Theme.of(context).unselectedWidgetColor ///``` @@ -116,7 +106,7 @@ class BuildColor { ///```dart ///return Theme.of(context).backgroundColor ///``` - Color get background => Theme.of(_context).backgroundColor; + Color get background => Theme.of(_context).colorScheme.surface; ///```dart ///return Theme.of(context).dialogBackgroundColor @@ -136,10 +126,6 @@ class BuildColor { ///```dart ///return Theme.of(context).errorColor ///``` - Color get error => Theme.of(_context).errorColor; + Color get error => Theme.of(_context).colorScheme.error; - ///```dart - ///return Theme.of(context).toggleableActiveColor - ///``` - Color get toggleableActive => Theme.of(_context).toggleableActiveColor; } diff --git a/lib/helpers/print.dart b/lib/helpers/print.dart index 250a310..4d49695 100644 --- a/lib/helpers/print.dart +++ b/lib/helpers/print.dart @@ -38,7 +38,7 @@ class _AnsiColor { 16; } - String message(Object? msg) => '${this}$msg$ansiDefault'; + String message(Object? msg) => '$this$msg$ansiDefault'; } void printColor(Object? object, PrintColorStyle style) { diff --git a/lib/helpers/routes/simple_cupertino_back_gesture_detector.dart b/lib/helpers/routes/simple_cupertino_back_gesture_detector.dart index 74a607c..ea1cf60 100644 --- a/lib/helpers/routes/simple_cupertino_back_gesture_detector.dart +++ b/lib/helpers/routes/simple_cupertino_back_gesture_detector.dart @@ -18,11 +18,11 @@ const int _kMaxPageBackAnimationTime = 300; // Milliseconds. class SimpleCupertinoBackGestureDetector extends StatefulWidget { const SimpleCupertinoBackGestureDetector({ - Key? key, + super.key, required this.route, required this.child, this.fractionalGesture = 0.1, - }) : super(key: key); + }); final Widget child; final PageRoute route; diff --git a/lib/helpers/routes/simple_cupertino_page_transition.dart b/lib/helpers/routes/simple_cupertino_page_transition.dart index eaab5ef..3cbb24a 100644 --- a/lib/helpers/routes/simple_cupertino_page_transition.dart +++ b/lib/helpers/routes/simple_cupertino_page_transition.dart @@ -27,7 +27,7 @@ class SimpleCupertinoPageTransition extends StatefulWidget { /// * `linearTransition` is whether to perform the transitions linearly. /// Used to precisely track back gesture drags. SimpleCupertinoPageTransition({ - Key? key, + super.key, required Animation primaryRouteAnimation, required Animation secondaryRouteAnimation, required this.child, @@ -59,8 +59,7 @@ class SimpleCupertinoPageTransition extends StatefulWidget { parent: primaryRouteAnimation, curve: routeCurve, ).drive(decoration) - : null, - super(key: key); + : null; /// The widget below this widget in the tree. final Widget child; diff --git a/lib/helpers/size.dart b/lib/helpers/size.dart index 3abc318..7d76216 100644 --- a/lib/helpers/size.dart +++ b/lib/helpers/size.dart @@ -6,7 +6,7 @@ class Margin extends EdgeInsets { ///```dart ///EdgeInsets.all(amount) ///``` - const Margin.all(double value) : super.all(value); + const Margin.all(super.value) : super.all(); ///Do that: ///```dart @@ -48,11 +48,11 @@ class Margin extends EdgeInsets { ///) ///``` const Margin.only({ - double left = 0.0, - double top = 0.0, - double right = 0.0, - double bottom = 0.0, - }) : super.only(left: left, top: top, right: right, bottom: bottom); + super.left, + super.top, + super.right, + super.bottom, + }) : super.only(); ///Do that: ///```dart @@ -69,9 +69,9 @@ class Margin extends EdgeInsets { ///vertical: vertical); ///``` const Margin.symmetric({ - double horizontal = 0.0, - double vertical = 0.0, - }) : super.symmetric(horizontal: horizontal, vertical: vertical); + super.horizontal, + super.vertical, + }) : super.symmetric(); ///Do that: ///```dart diff --git a/lib/helpers/transition.dart b/lib/helpers/transition.dart index f1dbd4c..b3b5b8c 100644 --- a/lib/helpers/transition.dart +++ b/lib/helpers/transition.dart @@ -7,7 +7,7 @@ import 'package:helpers/helpers.dart'; class OnScrollHideContent extends StatefulWidget { const OnScrollHideContent({ - Key? key, + super.key, this.onSizeChanged, this.onChanged, required this.controller, @@ -18,7 +18,7 @@ class OnScrollHideContent extends StatefulWidget { this.offsetToHideButton, this.onTop = true, this.opacity = false, - }) : super(key: key); + }); final void Function(double height)? onSizeChanged; final void Function(double height)? onChanged; @@ -158,10 +158,10 @@ class _OnScrollHideContentState extends State { class TimerPeriodicBuilder extends StatefulWidget { const TimerPeriodicBuilder({ - Key? key, + super.key, this.duration = const Duration(seconds: 1), required this.builder, - }) : super(key: key); + }); final WidgetBuilder builder; final Duration duration; @@ -197,7 +197,7 @@ class BooleanTween extends StatefulWidget { ///(controller.forward()), ///if it is FALSE it will execute the Tween from end to begin (controller.reverse()) const BooleanTween({ - Key? key, + super.key, required this.animate, required this.builder, this.child, @@ -206,7 +206,7 @@ class BooleanTween extends StatefulWidget { this.reverseCurve, this.reverseDuration, required this.tween, - }) : super(key: key); + }); ///If it is **TRUE**, it will execute the Tween from begin to end. /// @@ -297,12 +297,12 @@ class _BooleanTweenState extends State> class OpacityTransition extends StatefulWidget { /// It is a FadeTransition but this will be shown when receiving a Boolean value. const OpacityTransition({ - Key? key, + super.key, required this.visible, required this.child, this.duration = const Duration(milliseconds: 200), this.curve = Curves.linear, - }) : super(key: key); + }); /// It is the child that will be affected by the SwipeTransition final Widget child; @@ -345,7 +345,7 @@ class SwipeTransition extends StatelessWidget { /// that is, if you performed the effect inside a 100x100 container the child widget /// of the SwipeTransition would pop out of the container and be overexposed on top of its other widgets. const SwipeTransition({ - Key? key, + super.key, this.axis = Axis.vertical, this.axisAlignment = -1.0, required this.child, @@ -355,7 +355,7 @@ class SwipeTransition extends StatelessWidget { this.reverseCurve, this.reverseDuration, required this.visible, - }) : super(key: key); + }); /// [Axis.horizontal] if [sizeFactor] modifies the width, otherwise /// [Axis.vertical]. @@ -419,12 +419,12 @@ class SwipeTransition extends StatelessWidget { class AlignFactor extends StatelessWidget { const AlignFactor({ - Key? key, + super.key, required this.lerp, this.axis = Axis.vertical, this.axisAlignment = -1.0, required this.child, - }) : super(key: key); + }); final Axis axis; final double axisAlignment; @@ -452,7 +452,7 @@ class AlignFactor extends StatelessWidget { class TranslateTransition extends StatelessWidget { /// It is a type of transition very similar to SlideTransition. const TranslateTransition({ - Key? key, + super.key, this.begin = const Offset(0, 1), required this.child, this.curve = Curves.ease, @@ -461,7 +461,7 @@ class TranslateTransition extends StatelessWidget { this.textDirection, this.transformHitTests = true, required this.visible, - }) : super(key: key); + }); /// If true, it will show the widget in its position. /// If false, it will hide the widget. @@ -526,14 +526,14 @@ class TranslateTransition extends StatelessWidget { class TurnTransition extends StatelessWidget { /// It is a RotationTransition but this will be animate when receiving a Boolean value. const TurnTransition({ - Key? key, + super.key, required this.turn, required this.child, this.begin = 90, this.end = -90, this.curve = Curves.ease, this.duration = const Duration(milliseconds: 200), - }) : super(key: key); + }); ///BEGIN DEGREES (RANGE IS 0 - 359) final double begin; diff --git a/lib/helpers/widgets/align.dart b/lib/helpers/widgets/align.dart index ccd5621..f2636ec 100644 --- a/lib/helpers/widgets/align.dart +++ b/lib/helpers/widgets/align.dart @@ -2,11 +2,11 @@ import 'package:flutter/material.dart'; class TopLeftAlign extends StatelessWidget { const TopLeftAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -33,11 +33,11 @@ class TopLeftAlign extends StatelessWidget { class TopCenterAlign extends StatelessWidget { const TopCenterAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -64,11 +64,11 @@ class TopCenterAlign extends StatelessWidget { class TopRightAlign extends StatelessWidget { const TopRightAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -95,11 +95,11 @@ class TopRightAlign extends StatelessWidget { class CenterLeftAlign extends StatelessWidget { const CenterLeftAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -126,11 +126,11 @@ class CenterLeftAlign extends StatelessWidget { class CenterRightAlign extends StatelessWidget { const CenterRightAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -157,11 +157,11 @@ class CenterRightAlign extends StatelessWidget { class BottomLeftAlign extends StatelessWidget { const BottomLeftAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -188,11 +188,11 @@ class BottomLeftAlign extends StatelessWidget { class BottomCenterAlign extends StatelessWidget { const BottomCenterAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// @@ -219,11 +219,11 @@ class BottomCenterAlign extends StatelessWidget { class BottomRightAlign extends StatelessWidget { const BottomRightAlign({ - Key? key, + super.key, this.widthFactor, this.heightFactor, this.child, - }) : super(key: key); + }); /// If non-null, sets its width to the child's width multiplied by this factor. /// diff --git a/lib/helpers/widgets/animated_interactive_viewer.dart b/lib/helpers/widgets/animated_interactive_viewer.dart index acfd68b..9e5fbdb 100644 --- a/lib/helpers/widgets/animated_interactive_viewer.dart +++ b/lib/helpers/widgets/animated_interactive_viewer.dart @@ -4,12 +4,11 @@ class AnimatedInteractiveViewer extends StatefulWidget { ///It is very similar to the InteractiveViewer except the AnimatedInteractiveViewer ///have a double-tap animated zoom const AnimatedInteractiveViewer({ - Key? key, + super.key, required this.child, this.curve = Curves.ease, this.duration = const Duration(milliseconds: 200), this.clipBehavior = Clip.none, - this.alignPanAxis = false, this.boundaryMargin = EdgeInsets.zero, this.constrained = true, this.panEnabled = true, @@ -21,7 +20,7 @@ class AnimatedInteractiveViewer extends StatefulWidget { this.onInteractionUpdate, this.transformationController, this.onDoubleTapDown, - }) : super(key: key); + }); /// It is the curve that the SwipeTransition performs final Curve curve; @@ -43,19 +42,6 @@ class AnimatedInteractiveViewer extends StatefulWidget { /// Defaults to [Clip.hardEdge]. final Clip clipBehavior; - /// If true, panning is only allowed in the direction of the horizontal axis - /// or the vertical axis. - /// - /// In other words, when this is true, diagonal panning is not allowed. A - /// single gesture begun along one axis cannot also cause panning along the - /// other axis without stopping and beginning a new gesture. This is a common - /// pattern in tables where data is displayed in columns and rows. - /// - /// See also: - /// * [constrained], which has an example of creating a table that uses - /// alignPanAxis. - final bool alignPanAxis; - /// A margin for the visible boundaries of the child. /// /// Any transformation that results in the viewport being able to view outside @@ -478,7 +464,6 @@ class _AnimatedInteractiveViewerState extends State clipBehavior: widget.clipBehavior, constrained: widget.constrained, panEnabled: widget.panEnabled, - alignPanAxis: widget.alignPanAxis, boundaryMargin: widget.boundaryMargin, scaleEnabled: widget.scaleEnabled, child: GestureDetector( diff --git a/lib/helpers/widgets/carousel/widgets/carousel.dart b/lib/helpers/widgets/carousel/widgets/carousel.dart index 3e98aab..91f9b45 100644 --- a/lib/helpers/widgets/carousel/widgets/carousel.dart +++ b/lib/helpers/widgets/carousel/widgets/carousel.dart @@ -103,7 +103,7 @@ class CarouselController { class Carousel extends StatefulWidget { Carousel({ - Key? key, + super.key, required this.itemBuilder, required this.itemCount, CarouselController? controller, @@ -123,8 +123,7 @@ class Carousel extends StatefulWidget { this.clipBehavior = Clip.none, this.scrollBehavior, this.initialPage = 0, - }) : controller = controller ?? CarouselController(), - super(key: key); + }) : controller = controller ?? CarouselController(); final Widget Function(BuildContext context, int index) itemBuilder; diff --git a/lib/helpers/widgets/carousel/widgets/carousel_container.dart b/lib/helpers/widgets/carousel/widgets/carousel_container.dart index d6cd5db..127f8a1 100644 --- a/lib/helpers/widgets/carousel/widgets/carousel_container.dart +++ b/lib/helpers/widgets/carousel/widgets/carousel_container.dart @@ -3,12 +3,12 @@ import 'package:helpers/helpers.dart'; class CarouselContainer extends StatelessWidget { const CarouselContainer({ - Key? key, + super.key, required this.carousel, this.aspectRatio, this.height, this.padding, - }) : super(key: key); + }); final Widget Function(double viewportFraction) carousel; final double? aspectRatio; diff --git a/lib/helpers/widgets/carousel/widgets/carousel_parallax.dart b/lib/helpers/widgets/carousel/widgets/carousel_parallax.dart index c03275d..d53de6d 100644 --- a/lib/helpers/widgets/carousel/widgets/carousel_parallax.dart +++ b/lib/helpers/widgets/carousel/widgets/carousel_parallax.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; class CarouselParallax extends StatelessWidget { const CarouselParallax({ - Key? key, + super.key, required this.child, this.curve = Curves.ease, required this.height, @@ -10,7 +10,7 @@ class CarouselParallax extends StatelessWidget { this.minScale = 0.64, required this.page, this.parallaxEffect = false, - }) : super(key: key); + }); final Widget child; final Curve curve; diff --git a/lib/helpers/widgets/interactive_table.dart b/lib/helpers/widgets/interactive_table.dart index 1597fcd..0ed4d33 100644 --- a/lib/helpers/widgets/interactive_table.dart +++ b/lib/helpers/widgets/interactive_table.dart @@ -3,13 +3,13 @@ import 'package:vector_math/vector_math_64.dart' show Quad; class InteractiveTable extends StatefulWidget { const InteractiveTable({ - Key? key, + super.key, required this.itemBuilder, required this.cellHeight, required this.cellWidth, required this.columnsCount, required this.rowsCount, - }) : super(key: key); + }); final Widget Function(int row, int column) itemBuilder; final double cellHeight; @@ -85,10 +85,9 @@ class _InteractiveTableState extends State { class _TableInheritedWidget extends InheritedWidget { const _TableInheritedWidget({ - Key? key, required this.state, - required Widget child, - }) : super(key: key, child: child); + required super.child, + }); final _InteractiveTableState state; @@ -104,7 +103,7 @@ class _TableInheritedWidget extends InheritedWidget { } class _Table extends StatelessWidget { - const _Table({Key? key}) : super(key: key); + const _Table(); @override Widget build(BuildContext context) { diff --git a/lib/helpers/widgets/keyboard.dart b/lib/helpers/widgets/keyboard.dart index 0efcb64..25a0bf1 100644 --- a/lib/helpers/widgets/keyboard.dart +++ b/lib/helpers/widgets/keyboard.dart @@ -3,10 +3,10 @@ import 'package:helpers/helpers.dart'; class KeyboardVisibilityBuilder extends StatefulWidget { const KeyboardVisibilityBuilder({ - Key? key, + super.key, this.child, required this.builder, - }) : super(key: key); + }); final Widget Function( BuildContext context, @@ -61,10 +61,10 @@ class _KeyboardVisibilityBuilderState extends State class DismissKeyboard extends StatelessWidget { ///Tapping on a Widget will apply the FocusScope to it and hide the keyboard. const DismissKeyboard({ - Key? key, + super.key, this.child, this.behavior = HitTestBehavior.opaque, - }) : super(key: key); + }); final HitTestBehavior behavior; final Widget? child; diff --git a/lib/helpers/widgets/lazy_load_builder.dart b/lib/helpers/widgets/lazy_load_builder.dart index 75ff025..9e0b882 100644 --- a/lib/helpers/widgets/lazy_load_builder.dart +++ b/lib/helpers/widgets/lazy_load_builder.dart @@ -9,13 +9,13 @@ typedef LazyLoadWidgetBuilder = Widget Function( class LazyLoadBuilder extends StatefulWidget { const LazyLoadBuilder({ - Key? key, + super.key, this.onLoad, required this.builder, required this.controller, this.startLoadBeforeOffset = -80, this.status, - }) : super(key: key); + }); final Future Function()? onLoad; final LazyLoadWidgetBuilder builder; diff --git a/lib/helpers/widgets/numeric_pad.dart b/lib/helpers/widgets/numeric_pad.dart index bb9f18e..2342f61 100644 --- a/lib/helpers/widgets/numeric_pad.dart +++ b/lib/helpers/widgets/numeric_pad.dart @@ -47,11 +47,10 @@ class NumericPadStyle { class _NumericInheritedWidget extends InheritedWidget { const _NumericInheritedWidget({ - Key? key, required this.onTap, required this.style, - required Widget child, - }) : super(key: key, child: child); + required super.child, + }); final NumericPadStyle style; final void Function(String text) onTap; @@ -70,14 +69,14 @@ class _NumericInheritedWidget extends InheritedWidget { class NumericPad extends StatefulWidget { const NumericPad({ - Key? key, + super.key, required this.onButtonTap, this.style = const NumericPadStyle(), this.numbers = const [ ...kNumericPadNumbers, [NumericPadNumber.dot, NumericPadNumber.zero, NumericPadNumber.none], ], - }) : super(key: key); + }); final NumericPadStyle style; @@ -108,29 +107,29 @@ class _NumericPadState extends State { } class _NumericButton extends StatelessWidget { - const _NumericButton(this.number, {Key? key}) : super(key: key); + const _NumericButton(this.number); final NumericPadNumber number; @override Widget build(BuildContext context) { - final _NumericInheritedWidget _numeric = + final _NumericInheritedWidget numeric = _NumericInheritedWidget.of(context); return SplashTap( onTap: - number.title.isNotEmpty ? () => _numeric.onTap(number.title) : null, - shape: _numeric.style.buttonShape, + number.title.isNotEmpty ? () => numeric.onTap(number.title) : null, + shape: numeric.style.buttonShape, child: Container( alignment: Alignment.center, - width: _numeric.style.buttonWidth, - height: _numeric.style.buttonHeight, - padding: _numeric.style.buttonPadding, + width: numeric.style.buttonWidth, + height: numeric.style.buttonHeight, + padding: numeric.style.buttonPadding, child: number.child ?? Text( number.title, - style: _numeric.style.style ?? - context.textTheme.bodyText1 ?? + style: numeric.style.style ?? + context.textTheme.bodyLarge ?? const TextStyle(), ), ), diff --git a/lib/helpers/widgets/scrollabe_table.dart b/lib/helpers/widgets/scrollabe_table.dart index d13b811..06fa0bf 100644 --- a/lib/helpers/widgets/scrollabe_table.dart +++ b/lib/helpers/widgets/scrollabe_table.dart @@ -5,7 +5,7 @@ import 'package:helpers/helpers.dart'; class ScrollableTable extends StatefulWidget { const ScrollableTable({ - Key? key, + super.key, this.scrollViewWrapper, this.tableWrapper, this.cellPadding, @@ -40,7 +40,7 @@ class ScrollableTable extends StatefulWidget { this.isEmptyBackground, this.tablePadding, this.verticalController, - }) : super(key: key); + }); final Widget Function(Widget child)? scrollViewWrapper; final Widget Function(Widget child)? tableWrapper; @@ -281,7 +281,7 @@ class _ScrollableTableState extends State> { final BuildMedia media = context.media; final double height = media.height; - Widget _sliverRows({required int? itemCount}) { + Widget sliverRows({required int? itemCount}) { final Decoration decoration = BoxDecoration( border: hasBorder ? Border( @@ -314,11 +314,11 @@ class _ScrollableTableState extends State> { Widget rows = widget.rowsListenable != null ? ValueListenableBuilder>( valueListenable: widget.rowsListenable!, - builder: (_, value, ___) => _sliverRows( + builder: (_, value, ___) => sliverRows( itemCount: value.length, ), ) - : _sliverRows(itemCount: widget.itemCount); + : sliverRows(itemCount: widget.itemCount); if (widget.isLoading != null) { rows = ValueListenableBuilder( diff --git a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet.dart b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet.dart index 8feba68..977e6f9 100644 --- a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet.dart +++ b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet.dart @@ -8,10 +8,9 @@ enum _SlidingBottomSheetFocusType { sliver, panel } class _SlidingBottomSheetInheritedWidget extends InheritedWidget { const _SlidingBottomSheetInheritedWidget({ - Key? key, required this.controller, - required Widget child, - }) : super(key: key, child: child); + required super.child, + }); final SlidingBottomSheetController controller; @@ -70,7 +69,7 @@ class SlidingBottomSheet extends StatefulWidget { ///); ///``` SlidingBottomSheet({ - Key? key, + super.key, required this.builder, this.controller, this.isDraggable = true, @@ -89,8 +88,7 @@ class SlidingBottomSheet extends StatefulWidget { this.resizeToAvoidBottomInset, this.scrollController, this.onSizeChanged, - }) : backgroundColor = backgroundColor ?? Colors.black.withOpacity(0.2), - super(key: key); + }) : backgroundColor = backgroundColor ?? Colors.black.withOpacity(0.2); ///Provides a [ScrollController] to attach to a scrollable ///object in the panel that links the panel position with the scroll position. diff --git a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_chevron.dart b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_chevron.dart index 9724bec..84910fa 100644 --- a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_chevron.dart +++ b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_chevron.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; import 'package:helpers/helpers.dart'; class SlidingBottomSheetChevron extends StatelessWidget { - const SlidingBottomSheetChevron({Key? key, this.color = Colors.white}) - : super(key: key); + const SlidingBottomSheetChevron({super.key, this.color = Colors.white}); final Color color; diff --git a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_container.dart b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_container.dart index 0953aa2..bf0c9f2 100644 --- a/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_container.dart +++ b/lib/helpers/widgets/sliding_bottom_sheet/widgets/sliding_bottom_sheet_container.dart @@ -17,7 +17,7 @@ class SlidingBottomSheetContainer extends StatefulWidget { ///); /// ``` const SlidingBottomSheetContainer({ - Key? key, + super.key, this.padding = const Margin.all(20.0), this.borderRadius = const BorderRadius.vertical(top: Radius.circular(20.0)), this.margin = const Margin.vertical(20.0), @@ -33,7 +33,7 @@ class SlidingBottomSheetContainer extends StatefulWidget { this.scrollPhysics, this.scrollToBottom = true, this.clipper, - }) : super(key: key); + }); final Curve animatedSizeCurve; final Duration animatedSizeDuration; diff --git a/lib/helpers/widgets/text.dart b/lib/helpers/widgets/text.dart index 4b5e1f4..20ff544 100644 --- a/lib/helpers/widgets/text.dart +++ b/lib/helpers/widgets/text.dart @@ -8,7 +8,7 @@ class Headline1 extends StatelessWidget { ///``` const Headline1( this.text, { - Key? key, + super.key, this.style, this.textAlign, this.textSpan, @@ -21,7 +21,7 @@ class Headline1 extends StatelessWidget { this.maxLines, this.semanticsLabel, this.textWidthBasis, - }) : super(key: key); + }); ///The text to display. final String text; @@ -127,7 +127,7 @@ class Headline1 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline1!.merge(style)); + style: context.textTheme.displayLarge!.merge(style)); } } @@ -137,7 +137,7 @@ class Headline2 extends StatelessWidget { ///return Text(text, style: context.textTheme.headline2); ///``` const Headline2(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -149,8 +149,7 @@ class Headline2 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -255,7 +254,7 @@ class Headline2 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline2!.merge(style)); + style: context.textTheme.displayMedium!.merge(style)); } } @@ -265,7 +264,7 @@ class Headline3 extends StatelessWidget { ///return Text(text, style: context.textTheme.headline3); ///``` const Headline3(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -277,8 +276,7 @@ class Headline3 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -383,7 +381,7 @@ class Headline3 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline3!.merge(style)); + style: context.textTheme.displaySmall!.merge(style)); } } @@ -393,7 +391,7 @@ class Headline4 extends StatelessWidget { ///return Text(text, style: context.textTheme.headline4); ///``` const Headline4(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -405,8 +403,7 @@ class Headline4 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -511,7 +508,7 @@ class Headline4 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline4!.merge(style)); + style: context.textTheme.headlineMedium!.merge(style)); } } @@ -521,7 +518,7 @@ class Headline5 extends StatelessWidget { ///return Text(text, style: context.textTheme.headline5); ///``` const Headline5(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -533,8 +530,7 @@ class Headline5 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -639,7 +635,7 @@ class Headline5 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline5!.merge(style)); + style: context.textTheme.headlineSmall!.merge(style)); } } @@ -649,7 +645,7 @@ class Headline6 extends StatelessWidget { ///return Text(text, style: context.textTheme.headline6); ///``` const Headline6(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -661,8 +657,7 @@ class Headline6 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -767,7 +762,7 @@ class Headline6 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.headline6!.merge(style)); + style: context.textTheme.titleLarge!.merge(style)); } } @@ -777,7 +772,7 @@ class Subtitle1 extends StatelessWidget { ///return Text(text, style: context.textTheme.subtitle1); ///``` const Subtitle1(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -789,8 +784,7 @@ class Subtitle1 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -895,7 +889,7 @@ class Subtitle1 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.subtitle1!.merge(style)); + style: context.textTheme.titleMedium!.merge(style)); } } @@ -905,7 +899,7 @@ class Subtitle2 extends StatelessWidget { ///return Text(text, style: context.textTheme.subtitle2); ///``` const Subtitle2(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -917,8 +911,7 @@ class Subtitle2 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -1023,7 +1016,7 @@ class Subtitle2 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.subtitle2!.merge(style)); + style: context.textTheme.titleSmall!.merge(style)); } } @@ -1033,7 +1026,7 @@ class BodyText1 extends StatelessWidget { ///return Text(text, style: context.textTheme.bodyText1); ///``` const BodyText1(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -1045,8 +1038,7 @@ class BodyText1 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -1151,7 +1143,7 @@ class BodyText1 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.bodyText1!.merge(style)); + style: context.textTheme.bodyLarge!.merge(style)); } } @@ -1161,7 +1153,7 @@ class BodyText2 extends StatelessWidget { ///return Text(text, style: context.textTheme.bodyText2); ///``` const BodyText2(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -1173,8 +1165,7 @@ class BodyText2 extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -1279,7 +1270,7 @@ class BodyText2 extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.bodyText2!.merge(style)); + style: context.textTheme.bodyMedium!.merge(style)); } } @@ -1289,7 +1280,7 @@ class CaptionText extends StatelessWidget { ///return Text(text, style: context.textTheme.caption); ///``` const CaptionText(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -1301,8 +1292,7 @@ class CaptionText extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -1407,7 +1397,7 @@ class CaptionText extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.caption!.merge(style)); + style: context.textTheme.bodySmall!.merge(style)); } } @@ -1417,7 +1407,7 @@ class ButtonText extends StatelessWidget { ///return Text(text, style: context.textTheme.button); ///``` const ButtonText(this.text, - {Key? key, + {super.key, this.style, this.textAlign, this.textSpan, @@ -1429,8 +1419,7 @@ class ButtonText extends StatelessWidget { this.textScaleFactor, this.maxLines, this.semanticsLabel, - this.textWidthBasis}) - : super(key: key); + this.textWidthBasis}); ///The text to display. final String text; @@ -1535,7 +1524,7 @@ class ButtonText extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.button!.merge(style)); + style: context.textTheme.labelLarge!.merge(style)); } } @@ -1546,7 +1535,7 @@ class OverlineText extends StatelessWidget { ///``` const OverlineText( this.text, { - Key? key, + super.key, this.style, this.textAlign, this.textSpan, @@ -1559,7 +1548,7 @@ class OverlineText extends StatelessWidget { this.maxLines, this.semanticsLabel, this.textWidthBasis, - }) : super(key: key); + }); ///The text to display. final String text; @@ -1665,7 +1654,7 @@ class OverlineText extends StatelessWidget { strutStyle: strutStyle, textWidthBasis: textWidthBasis, semanticsLabel: semanticsLabel, - style: context.textTheme.overline!.merge(style), + style: context.textTheme.labelSmall!.merge(style), ); } } diff --git a/lib/helpers/widgets/widgets.dart b/lib/helpers/widgets/widgets.dart index fc1d60d..28c044a 100644 --- a/lib/helpers/widgets/widgets.dart +++ b/lib/helpers/widgets/widgets.dart @@ -22,7 +22,7 @@ class DoubleColumn extends StatelessWidget { /// ]); ///``` const DoubleColumn({ - Key? key, + super.key, this.columnCrossAxisAlignment = CrossAxisAlignment.center, this.columnMainAxisAlignment = MainAxisAlignment.start, this.columnSize = MainAxisSize.min, @@ -34,7 +34,7 @@ class DoubleColumn extends StatelessWidget { this.rowMainAxisAlignment = MainAxisAlignment.start, this.rowSize = MainAxisSize.max, this.spaceBeetween = 20, - }) : super(key: key); + }); final CrossAxisAlignment columnCrossAxisAlignment; final MainAxisAlignment columnMainAxisAlignment; @@ -82,8 +82,7 @@ class RemoveGlowScrollBehavior extends ScrollBehavior { const RemoveGlowScrollBehavior(); @override - Widget buildViewportChrome( - BuildContext context, Widget child, AxisDirection axisDirection) { + Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { return child; } } @@ -91,7 +90,7 @@ class RemoveGlowScrollBehavior extends ScrollBehavior { class RemoveScrollGlow extends StatelessWidget { ///Eliminate the Splash Effect or Glow Effect when reaching ///the limit of a PageView, ScrollView, ListView, etc. - const RemoveScrollGlow({Key? key, required this.child}) : super(key: key); + const RemoveScrollGlow({super.key, required this.child}); final Widget child; @@ -125,7 +124,7 @@ class SizeBuilder extends StatefulWidget { /// return widget.builder(constraints.maxWidth, constraints.maxHeight); ///}); ///``` - const SizeBuilder({Key? key, this.builder}) : super(key: key); + const SizeBuilder({super.key, this.builder}); ///Argument `(double width, double height)` final Widget Function(double width, double height)? builder; @@ -150,7 +149,7 @@ class ExpandedSpacer extends StatelessWidget { ///```dart ///return Expanded(child: SizedBox()) ///``` - const ExpandedSpacer({Key? key}) : super(key: key); + const ExpandedSpacer({super.key}); @override Widget build(BuildContext context) { @@ -167,7 +166,7 @@ class ExpandedTap extends StatelessWidget { /// ), ///); ///``` - const ExpandedTap({Key? key, this.onTap, this.child}) : super(key: key); + const ExpandedTap({super.key, this.onTap, this.child}); final void Function()? onTap; final Widget? child; @@ -190,10 +189,10 @@ class ExpandedAlign extends StatelessWidget { ///); ///``` const ExpandedAlign({ - Key? key, + super.key, this.alignment = Alignment.centerRight, this.child, - }) : super(key: key); + }); final Alignment alignment; final Widget? child; @@ -219,12 +218,11 @@ class SafeAreaColor extends StatelessWidget { /// ); /// ``` const SafeAreaColor( - {Key? key, + {super.key, this.child, this.color = Colors.white, this.height, - this.width = double.infinity}) - : super(key: key); + this.width = double.infinity}); final Widget? child; final Color color; @@ -258,10 +256,10 @@ class OpaqueTap extends StatelessWidget { ///); ///``` const OpaqueTap({ - Key? key, + super.key, required this.onTap, required this.child, - }) : super(key: key); + }); final void Function() onTap; final Widget child; @@ -278,12 +276,12 @@ class OpaqueTap extends StatelessWidget { class SplashTap extends StatelessWidget { const SplashTap({ - Key? key, + super.key, required this.onTap, required this.child, this.color, this.shape = BoxShape.rectangle, - }) : super(key: key); + }); ///Creates an ink well. final void Function()? onTap; @@ -310,7 +308,7 @@ class SplashTap extends StatelessWidget { class SplashButton extends StatelessWidget { const SplashButton({ - Key? key, + super.key, required this.onTap, required this.child, this.color = Colors.blue, @@ -320,8 +318,7 @@ class SplashButton extends StatelessWidget { this.shape = BoxShape.rectangle, }) : padding = padding ?? const EdgeInsets.all(20.0), borderRadius = - borderRadius ?? const BorderRadius.all(Radius.circular(20.0)), - super(key: key); + borderRadius ?? const BorderRadius.all(Radius.circular(20.0)); ///Creates an ink well. final void Function() onTap; @@ -381,7 +378,7 @@ class SplashButton extends StatelessWidget { class TileDesigned extends StatelessWidget { const TileDesigned({ - Key? key, + super.key, this.onTap, this.prefix, this.child, @@ -389,7 +386,7 @@ class TileDesigned extends StatelessWidget { this.background = Colors.transparent, this.padding = const EdgeInsets.all(20.0), this.borderRadius = const BorderRadius.all(Radius.circular(20.0)), - }) : super(key: key); + }); ///Creates an ink well. final void Function()? onTap; diff --git a/pubspec.lock b/pubspec.lock index 4931f38..a99d0b2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,42 +5,48 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -53,41 +59,70 @@ packages: description: flutter source: sdk version: "0.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lint: dependency: "direct dev" description: name: lint - url: "https://pub.dartlang.org" + sha256: d758a5211fce7fd3f5e316f804daefecdc34c7e53559716125e6da7388ae8565 + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "2.3.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.12.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -97,51 +132,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.7.0" vector_math: dependency: "direct main" description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=1.17.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 88e0085..a8aab1f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.2.0 homepage: https://github.com/seel-channel/helpers environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" + sdk: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" dependencies: flutter: @@ -15,4 +15,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - lint: ^1.8.1 + lint: ^2.3.0