From a9ef3a827c6c7bd01216d5f0fd0dfe1870a7feca Mon Sep 17 00:00:00 2001 From: "muhammad.abbasi" Date: Sun, 15 Sep 2024 14:32:27 +0300 Subject: [PATCH] null seafty bug fixes --- .../stapper_widget/components/base_step.dart | 75 +++++------- .../components/base_step_delegate.dart | 4 +- .../components/custom_line.dart | 18 +-- .../stapper_widget/custom_stepper.dart | 107 ++++++++---------- lib/dashboard_latest/dashboard_provider.dart | 2 +- pubspec.yaml | 53 +++++---- 6 files changed, 117 insertions(+), 142 deletions(-) diff --git a/lib/common_widgets/stapper_widget/components/base_step.dart b/lib/common_widgets/stapper_widget/components/base_step.dart index 7ecea1b3..890010c1 100644 --- a/lib/common_widgets/stapper_widget/components/base_step.dart +++ b/lib/common_widgets/stapper_widget/components/base_step.dart @@ -10,26 +10,26 @@ enum BorderType { normal, dotted } class BaseStep extends StatelessWidget { const BaseStep({ - Key key, - @required this.step, - @required this.isActive, - @required this.isFinished, - @required this.isAlreadyReached, - @required this.radius, - @required this.isUnreached, - @required this.activeStepBackgroundColor, - @required this.unreachedBackgroundColor, - @required this.activeStepBorderColor, - @required this.unreachedBorderColor, - @required this.activeTextColor, - @required this.activeIconColor, - @required this.unreachedTextColor, - @required this.unreachedIconColor, - @required this.padding, - @required this.stepRadius, - @required this.showStepBorder, - @required this.lineLength, - @required this.enabled, + Key ?key, + required this.step, + required this.isActive, + required this.isFinished, + required this.isAlreadyReached, + required this.radius, + required this.isUnreached, + required this.activeStepBackgroundColor, + required this.unreachedBackgroundColor, + required this.activeStepBorderColor, + required this.unreachedBorderColor, + required this.activeTextColor, + required this.activeIconColor, + required this.unreachedTextColor, + required this.unreachedIconColor, + required this.padding, + required this.stepRadius, + required this.showStepBorder, + required this.lineLength, + required this.enabled, }) : super(key: key); final StepModel step; final bool isActive; @@ -122,20 +122,7 @@ class BaseStep extends StatelessWidget { return SizedBox( width: (radius * 4.5) + (padding ?? 0), - child: step.customTitle ?? - Text( - step.title ?? '', - maxLines: 3, - textAlign: TextAlign.center, - softWrap: false, - overflow: TextOverflow.visible, - style: Theme.of(context).textTheme.bodyMedium.copyWith( - color: _handleTitleColor( - context, isFinished, isActive, isAlreadyReached), - height: 1, - // fontSize: radius * 0.45, - ), - ), + child: step.customTitle, ); } @@ -163,7 +150,7 @@ class StepModel { final Icon icon; final Icon finishIcon; final Icon activeIcon; - final Widget customStep; + final Widget? customStep; final String title; final Widget customTitle; final String lineText; @@ -171,16 +158,16 @@ class StepModel { final bool topTitle; final bool enabled; const StepModel({ - this.icon, - this.finishIcon, - this.activeIcon, - this.title, - this.lineText, - this.customStep, - this.customTitle, - this.customLineWidget, + required this.icon, + required this.finishIcon, + required this.activeIcon, + required this.title, + required this.lineText, + this.customStep, + required this.customTitle, + required this.customLineWidget, this.topTitle = false, this.enabled = true, - }) : assert(icon != null || customStep != null); + }); } diff --git a/lib/common_widgets/stapper_widget/components/base_step_delegate.dart b/lib/common_widgets/stapper_widget/components/base_step_delegate.dart index 43af00ee..12e14295 100644 --- a/lib/common_widgets/stapper_widget/components/base_step_delegate.dart +++ b/lib/common_widgets/stapper_widget/components/base_step_delegate.dart @@ -8,8 +8,8 @@ class BaseStepDelegate extends MultiChildLayoutDelegate { final bool topTitle; BaseStepDelegate({ - @required this.stepRadius, - @required this.direction, + required this.stepRadius, + required this.direction, this.topTitle = false, }); diff --git a/lib/common_widgets/stapper_widget/components/custom_line.dart b/lib/common_widgets/stapper_widget/components/custom_line.dart index 2e29ac0d..09e30ab8 100644 --- a/lib/common_widgets/stapper_widget/components/custom_line.dart +++ b/lib/common_widgets/stapper_widget/components/custom_line.dart @@ -6,7 +6,7 @@ class EasyLine extends StatelessWidget { final Color color; final double thickness; final double spacing; - final LineType lineType; + final LineType? lineType; final Axis axis; const EasyLine({ @@ -43,20 +43,20 @@ enum LineType { dashed, } class LineStyle { - final Color defaultLineColor; - final Color unreachedLineColor; - final Color activeLineColor; - final Color finishedLineColor; + final Color ?defaultLineColor; + final Color ?unreachedLineColor; + final Color ?activeLineColor; + final Color ?finishedLineColor; final double lineLength; final double lineThickness; final double lineWidth; final double lineSpace; final LineType lineType; - final LineType unreachedLineType; - final Color progressColor; - final double progress; + final LineType ?unreachedLineType; + final Color ?progressColor; + final double ?progress; const LineStyle({ - Key key, + Key ?key, this.lineType = LineType.dotted, this.defaultLineColor, this.unreachedLineColor, diff --git a/lib/common_widgets/stapper_widget/custom_stepper.dart b/lib/common_widgets/stapper_widget/custom_stepper.dart index 43818e14..19b3095b 100644 --- a/lib/common_widgets/stapper_widget/custom_stepper.dart +++ b/lib/common_widgets/stapper_widget/custom_stepper.dart @@ -6,25 +6,25 @@ import 'components/base_step.dart'; import 'components/custom_line.dart'; class CustomStepper extends StatefulWidget { final List steps; - final OnStepReached onStepReached; - final Color unreachedStepBackgroundColor; - final Color unreachedStepTextColor; - final Color unreachedStepIconColor; - final Color unreachedStepBorderColor; - final BorderType unreachedStepBorderType; + final OnStepReached ?onStepReached; + final Color ?unreachedStepBackgroundColor; + final Color ?unreachedStepTextColor; + final Color ?unreachedStepIconColor; + final Color ?unreachedStepBorderColor; + final BorderType ?unreachedStepBorderType; final Color activeStepBackgroundColor; - final Color activeStepTextColor; + final Color? activeStepTextColor; final Color activeStepIconColor; final Color activeStepBorderColor; - final BorderType activeStepBorderType; + final BorderType ?activeStepBorderType; final Color finishedStepBackgroundColor; - final Color finishedStepBorderColor; - final Color finishedStepTextColor; - final Color finishedStepIconColor; - final BorderType finishedStepBorderType; + final Color ?finishedStepBorderColor; + final Color ?finishedStepTextColor; + final Color ?finishedStepIconColor; + final BorderType ?finishedStepBorderType; final double stepRadius; final int activeStep; - final int maxReachedStep; + final int ?maxReachedStep; final Set? reachedSteps; final AlignmentGeometry alignment; final double internalPadding; @@ -34,11 +34,11 @@ class CustomStepper extends StatefulWidget { final Duration stepAnimationDuration; final double borderThickness; final StepShape stepShape; - final double stepBorderRadius; + final double ?stepBorderRadius; final bool showStepBorder; final bool showScrollbar; final bool fitWidth; - final LineStyle lineStyle; + final LineStyle ?lineStyle; const CustomStepper({ Key? key, @@ -85,9 +85,9 @@ class CustomStepper extends StatefulWidget { class _CustomStepperState extends State { late ScrollController _scrollController; - int _selectedIndex; - LineStyle lineStyle; - EdgeInsetsGeometry _padding; + int ?_selectedIndex; + LineStyle? lineStyle; + EdgeInsetsGeometry? _padding; @override void initState() { @@ -97,14 +97,14 @@ class _CustomStepperState extends State { _padding = const EdgeInsetsDirectional.all(10); if (widget.steps.any((element) => element.topTitle)) { - _padding = _padding.add(const EdgeInsetsDirectional.only(top: 45)); + _padding = _padding!.add(const EdgeInsetsDirectional.only(top: 45)); } if (widget.titlesAreLargerThanSteps) { - _padding = _padding.add(EdgeInsetsDirectional.symmetric( - horizontal: lineStyle.lineLength / 2)); + _padding = _padding!.add(EdgeInsetsDirectional.symmetric( + horizontal: lineStyle!.lineLength / 2)); } if (widget.padding != null) { - _padding.add(widget.padding); + _padding!.add(widget.padding); } super.initState(); @@ -126,21 +126,6 @@ class _CustomStepperState extends State { super.dispose(); } - /// Controls the step scrolling. - void _afterLayout(_) { - for (int i = 0; i < widget.steps.length; i++) { - _scrollController.animateTo( - i * - ((widget.stepRadius * 2) + - widget.internalPadding + - lineStyle.lineLength), - duration: widget.stepAnimationDuration, - curve: widget.stepAnimationCurve, - ); - - if (_selectedIndex == i) break; - } - } @override Widget build(BuildContext context) { @@ -184,26 +169,26 @@ class _CustomStepperState extends State { radius: widget.stepRadius, isActive: index == widget.activeStep, isFinished: widget.reachedSteps != null - ? index < widget.activeStep && widget.reachedSteps.contains(index) + ? index < widget.activeStep && widget.reachedSteps!.contains(index) : index < widget.activeStep, isUnreached: index > widget.activeStep, isAlreadyReached: widget.reachedSteps != null - ? widget.reachedSteps.contains(index) + ? widget.reachedSteps!.contains(index) : widget.maxReachedStep != null - ? index <= widget.maxReachedStep + ? index <= widget.maxReachedStep! : false, activeStepBackgroundColor: widget.activeStepBackgroundColor, activeStepBorderColor: widget.activeStepBorderColor, - activeTextColor: widget.activeStepTextColor, + activeTextColor: widget.activeStepTextColor??AppColor.neutral100, activeIconColor: widget.activeStepIconColor, - unreachedBackgroundColor: widget.unreachedStepBackgroundColor, - unreachedBorderColor: widget.unreachedStepBorderColor, - unreachedTextColor: widget.unreachedStepTextColor, - unreachedIconColor: widget.unreachedStepIconColor, + unreachedBackgroundColor: widget.unreachedStepBackgroundColor??AppColor.white10, + unreachedBorderColor: widget.unreachedStepBorderColor??AppColor.neutral100, + unreachedTextColor: widget.unreachedStepTextColor??AppColor.neutral100, + unreachedIconColor: widget.unreachedStepIconColor??AppColor.neutral100, padding: max(widget.internalPadding, 0), - stepRadius: widget.stepBorderRadius, + stepRadius: widget.stepBorderRadius??10, showStepBorder: widget.showStepBorder, - lineLength: lineStyle.lineLength, + lineLength: lineStyle!.lineLength, enabled: widget.steps[index].enabled, ); } @@ -224,20 +209,20 @@ class _CustomStepperState extends State { // } Color _getLineColor(int index) { - Color preferredColor; + Color ?preferredColor; if (index == widget.activeStep) { //Active Step - preferredColor = lineStyle.activeLineColor; + preferredColor = lineStyle!.activeLineColor??AppColor.primary10; } else if (index > widget.activeStep) { //Unreached Step - preferredColor = lineStyle.unreachedLineColor; + preferredColor = lineStyle!.unreachedLineColor??AppColor.primary10; } else if (index < widget.activeStep) { //Finished Step - preferredColor = lineStyle.finishedLineColor; + preferredColor = lineStyle!.finishedLineColor??AppColor.primary10; } return preferredColor ?? - lineStyle.defaultLineColor ?? + lineStyle!.defaultLineColor ?? Theme.of(context).colorScheme.primary; } @@ -248,7 +233,7 @@ class _CustomStepperState extends State { Padding( padding: EdgeInsets.only( top: axis == Axis.horizontal - ? (widget.stepRadius - lineStyle.lineThickness) + ? (widget.stepRadius - lineStyle!.lineThickness) : 0, ), child: _buildBaseLine(index, axis), @@ -257,7 +242,7 @@ class _CustomStepperState extends State { widget.steps[index].lineText != null) ...[ const SizedBox(height: 5), SizedBox( - width: lineStyle.lineLength, + width: lineStyle!.lineLength, child: widget.steps[index].customLineWidget ?? Text( widget.steps[index].lineText, @@ -274,16 +259,16 @@ class _CustomStepperState extends State { EasyLine _buildBaseLine(int index, Axis axis) { return EasyLine( - length: lineStyle.lineLength, + length: lineStyle!.lineLength, color: _getLineColor(index), - thickness: lineStyle.lineThickness, - spacing: lineStyle.lineSpace, - width: lineStyle.lineWidth, + thickness: lineStyle!.lineThickness, + spacing: lineStyle!.lineSpace, + width: lineStyle!.lineWidth, axis: axis, lineType: - index > widget.activeStep - 1 && lineStyle.unreachedLineType != null - ? lineStyle.unreachedLineType - : lineStyle.lineType, + index > widget.activeStep - 1 && lineStyle!.unreachedLineType != null + ? lineStyle!.unreachedLineType + : lineStyle!.lineType, ); } } diff --git a/lib/dashboard_latest/dashboard_provider.dart b/lib/dashboard_latest/dashboard_provider.dart index 88243aab..3272a2c4 100644 --- a/lib/dashboard_latest/dashboard_provider.dart +++ b/lib/dashboard_latest/dashboard_provider.dart @@ -106,7 +106,7 @@ class DashBoardProvider extends ChangeNotifier { isDetailLoading = false; notifyListeners(); } else { - requestDetailList!.data!.addAll(DD.Data.fromJson(json.decode(response.body)["data"][0]).data); + requestDetailList!.data!.addAll(DD.DashboardDetail.fromJson(json.decode(response.body)['data']); isDetailLoading = false; notifyListeners(); } diff --git a/pubspec.yaml b/pubspec.yaml index a599ca43..d9ec191f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.2.2+9 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.5.0 <4.0.0" localization_dir: assets\translations @@ -38,54 +38,57 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.5 font_awesome_flutter: ^10.2.1 - http: ^0.13.5 + http: ^1.2.2 provider: ^6.0.3 shared_preferences: ^2.0.15 fluttertoast: ^8.0.9 - image_picker: ^0.8.6 + image_picker: ^1.1.2 url_launcher: ^6.1.6 - flutter_launcher_icons: ^0.10.0 + flutter_launcher_icons: ^0.13.1 package_info: ^2.0.2 share: ^2.0.4 - flutter_local_notifications: ^12.0.1+1 + flutter_local_notifications: ^17.2.2 cached_network_image: ^3.2.2 - carousel_slider: ^4.1.1 - intl: ^0.17.0 - flutter_typeahead: ^4.1.1 - speech_to_text: ^6.1.1 - firebase_core: ^2.4.0 - firebase_messaging: ^14.2.0 + carousel_slider: ^5.0.0 + intl: ^0.19.0 + flutter_typeahead: ^5.2.0 + speech_to_text: ^7.0.0 + firebase_core: ^3.4.1 + firebase_messaging: ^15.1.1 qr_code_scanner: ^1.0.1 flutter_sound: ^9.2.13 - permission_handler: ^10.2.0 - rive: ^0.9.1 + permission_handler: ^11.3.1 + rive: ^0.13.13 another_flushbar: pinput: - audioplayers: ^1.1.1 + audioplayers: ^6.1.0 flare_flutter: ^3.0.2 signature: ^5.3.0 - flutter_svg: ^1.1.6 - file_picker: ^5.2.5 - record_mp3: ^2.1.0 + flutter_svg: ^2.0.10+1 + file_picker: ^8.1.2 + record_mp3_plus: any path_provider: ^2.1.0 open_file: ^3.3.2 localization: ^2.1.0 dotted_border: ^2.1.0 - lottie: ^2.3.0 - shimmer: ^2.0.0 + lottie: ^3.1.2 + shimmer: ^3.0.0 flutter_advanced_switch: ^3.0.1 table_calendar: ^3.0.8 - image_cropper: ^3.0.3 - touchable: ^0.2.1 + image_cropper: ^8.0.2 + badges: ^3.1.1 - flutter_month_picker: ^0.0.2 - syncfusion_flutter_charts: ^21.2.3 - local_auth: ^2.1.6 +# buttons_tabbar: ^1.1.2 + flutter_custom_month_picker: ^0.1.3 + syncfusion_flutter_charts: ^26.2.14 + local_auth: ^2.3.0 + local_auth_darwin: any dev_dependencies: flutter_test: sdk: flutter - +dependency_overrides: + win32: ^5.5.4 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your