cdharris / flutter_duration_picker

A Flutter Widget for allowing a user to pick a duration (e.g. 5mins, 1h 30mins, etc)
MIT License
78 stars 49 forks source link

Issue #28 - Method not found: 'ButtonTheme.bar' #29

Closed RajaParikshit closed 2 years ago

RajaParikshit commented 3 years ago

Solution for issue #28

Error Stacktrace :

../../../../../../../../../.pub-cache/hosted/pub.dartlang.org/flutter_duration_picker-1.0.4/lib/flutter_duration_picker.dart:506:44: Error: Method not found: 'ButtonTheme.bar'.
    final Widget actions = new ButtonTheme.bar(
                                                         ^^^

As per SO post : https://stackoverflow.com/questions/66027441/error-method-not-found-buttontheme-bar

ButtonTheme.bar is Deprecated. We need to use ButtonBarTheme instead which offers more flexibility to configure ButtonBar widgets. This feature was deprecated after v1.9.1.

So need to change

final Widget actions = new ButtonTheme.bar(

to

final Widget actions = new ButtonBarTheme( data: ButtonBarTheme.of(context),

on line 579 of flutter_duration_picker.dart

bartektartanus commented 3 years ago

Looks like maintainer @cdharris is not responding, so I have prepared a workaround. If you just want working version for flutter beta/dev channel then add this to your pubspec.yaml

  flutter_duration_picker:
    git: 
      url: https://github.com/RajaParikshit/flutter_duration_picker
      ref: issue_#28_button_theme_bar

If someone (like me) used version from another PR #26 (which added decoration) and want both PR - use repo forked by me.

  flutter_duration_picker:
    git: https://github.com/bartektartanus/flutter_duration_picker
yelkamel commented 3 years ago

thanks @bartektartanus

juliansteenbakker commented 3 years ago

I also forked this repo and fixed this issue. Beside that i added null-safety support. You can find it at https://github.com/juliansteenbakker/duration_picker and https://pub.dev/packages/duration_picker.