diff --git a/example/lib/main_temp.dart b/example/lib/main_temp.dart index 4f9c2780..4cc7fb33 100644 --- a/example/lib/main_temp.dart +++ b/example/lib/main_temp.dart @@ -40,6 +40,7 @@ class _MyHomePageState extends State with SingleTickerProviderStateMixin { TabController tabController; final _ratingController = TextEditingController(); + bool check = false; @override void initState() { @@ -1146,55 +1147,112 @@ class _MyHomePageState extends State // .toList(), // ), -// Container( -// alignment: Alignment.center, -// child: GFCheckbox( -// size: GFSize.SMALL, -// onChanged: (val) { -// print('on change val $val'); -// }, -// value: true, -// type: GFCheckboxType.circle, -//// checkColor: GFColors.DANGER, -////activebgColor: Colors.green, -////inactivebgColor: Colors.white, -////activeBorderColor: Colors.red, -//// backgroundColor: Colors.green, -// ), -// ), + CheckboxListTile( + title: Text("title text"), + value: check, + onChanged: (newValue) { + setState(() { + check = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + ), - GFCheckbox( - size: GFSize.SMALL, - activebgColor: GFColors.DANGER, + GFCheckboxListTile( + color: Colors.blueGrey.withOpacity(0.3), + title: const Text('title'), + subTitle: const Text('subtitle'), +// avatar: const GFAvatar( +// backgroundColor: GFColors.SUCCESS, +// ), + description: const Text('description'), +// padding: const EdgeInsets.all(16), +// margin: const EdgeInsets.all(16), +// size: 24, +// type: GFCheckboxType.basic, +// checkColor: Colors.white, +// activebgColor: Colors.red, +// inactivebgColor: Colors.red.withOpacity(0.3), +// activeBorderColor: Colors.red, +// inactiveBorderColor: Colors.red.withOpacity(0.3), +// custombgColor: GFColors.SUCCESS, + value: check, onChanged: (val) { - print('on change val $val'); + setState(() { + check = val; + }); }, - value: true, - inactiveIcon: null, +// inactiveIcon: const Icon( +// Icons.close, +// color: GFColors.DARK, +// size: 16, +// ), +// activeIcon: const Icon( +// Icons.check, +// size: 20, +// color: GFColors.WHITE, +// ), ), - GFRadioButton( + Checkbox( + value: check, + onChanged: null, +// (val){ +// print('on change val $val'); +// } + ), + + + + GFCheckbox( size: GFSize.SMALL, - value: true, - type: GFRadioButtonType.basic, - radioColor: GFColors.SUCCESS, -// activebgColor: GFColors.ALT, -// inactivebgColor: GFColors.PRIMARY, -// activeBorderColor: GFColors.DANGER, -// inactiveBorderColor: GFColors.DARK, - onChanged: (val) { - print('on change val $val'); + activebgColor: GFColors.DANGER, + onChanged: +// null, + (val) { + setState(() { + check = val; + }); }, - activeIcon: const Icon( - Icons.check, - size: 20, - color: GFColors.DARK, - ), -// inactiveIcon: const Icon(Icons.close, size: 20, color: GFColors.DARK,), -// custombgColor: GFColors.SUCCESS, -// groupValue: + value: check, + inactiveIcon: null, ), +// GFCheckbox( +// size: GFSize.SMALL, +// onChanged: (val) { +// print('on change val $val'); +// }, +// value: true, +// type: GFCheckboxType.circle, +// checkColor: GFColors.DANGER, +//// activebgColor: Colors.green, +//// inactivebgColor: Colors.white, +//// activeBorderColor: Colors.red, +// ), +// +// GFRadioButton( +// size: GFSize.SMALL, +// value: true, +// type: GFRadioButtonType.basic, +// radioColor: GFColors.SUCCESS, +//// activebgColor: GFColors.ALT, +//// inactivebgColor: GFColors.PRIMARY, +//// activeBorderColor: GFColors.DANGER, +//// inactiveBorderColor: GFColors.DARK, +// onChanged: (val) { +// print('on change val $val'); +// }, +// activeIcon: const Icon( +// Icons.check, +// size: 20, +// color: GFColors.DARK, +// ), +//// inactiveIcon: const Icon(Icons.close, size: 20, color: GFColors.DARK,), +//// custombgColor: GFColors.SUCCESS, +//// groupValue: +// ), + // const Padding( // padding: EdgeInsets.only(left: 15, top: 30), // child: GFTypography( @@ -1371,70 +1429,39 @@ class _MyHomePageState extends State // ], // ), // ), + // - GFCheckboxListTile( - color: GFColors.ALT, - title: const Text('title'), - subTitle: const Text('subtitle'), -// titleText: 'sdfg', -// subtitleText: 'sdfg', - avatar: const GFAvatar( - backgroundColor: GFColors.SUCCESS, - ), - description: const Text('description'), - padding: const EdgeInsets.all(16), - margin: const EdgeInsets.all(16), - size: 24, - type: GFCheckboxType.basic, - checkColor: GFColors.WHITE, - activebgColor: GFColors.PRIMARY, - inactivebgColor: GFColors.WHITE, - activeBorderColor: GFColors.WHITE, - inactiveBorderColor: GFColors.DARK, - activeIcon: const Icon( - Icons.check, - size: 20, - color: GFColors.WHITE, - ), - custombgColor: GFColors.SUCCESS, - onChanged: (val) {}, - value: true, - inactiveIcon: const Icon( - Icons.close, - color: GFColors.DARK, - size: 16, - ), - ), + // - GFCarousel( -// initialPage: 1, - pagerSize: 12, - activeIndicator: Colors.pink, - passiveIndicator: Colors.pink.withOpacity(0.4), - viewportFraction: 1.0, -// aspectRatio: 1, - autoPlay: true, - enlargeMainPage: true, - pagination: true, - items: imageList - .map((url) => Container( - padding: const EdgeInsets.only(bottom: 16), - margin: const EdgeInsets.all(12), - child: ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(5)), - child: Image.network(url, - fit: BoxFit.cover, width: 1000), - ), - )) - .toList(), -// onPageChanged: (int index) { -// setState(() { -// index; -// }); -// }, - ), +// GFCarousel( +//// initialPage: 1, +// pagerSize: 12, +// activeIndicator: Colors.pink, +// passiveIndicator: Colors.pink.withOpacity(0.4), +// viewportFraction: 1.0, +//// aspectRatio: 1, +// autoPlay: true, +// enlargeMainPage: true, +// pagination: true, +// items: imageList +// .map((url) => Container( +// padding: const EdgeInsets.only(bottom: 16), +// margin: const EdgeInsets.all(12), +// child: ClipRRect( +// borderRadius: +// const BorderRadius.all(Radius.circular(5)), +// child: Image.network(url, +// fit: BoxFit.cover, width: 1000), +// ), +// )) +// .toList(), +//// onPageChanged: (int index) { +//// setState(() { +//// index; +//// }); +//// }, +// ), // // GFCarousel( @@ -1674,14 +1701,14 @@ class _MyHomePageState extends State // borderRadius: BorderRadius.circular(10.0), // ), - const GFIconBadge( - child: GFAvatar( - backgroundColor: GFColors.SUCCESS, - ), - counterChild: GFBadge( - text: '12', - ), - ), +// const GFIconBadge( +// child: GFAvatar( +// backgroundColor: GFColors.SUCCESS, +// ), +// counterChild: GFBadge( +// text: '12', +// ), +// ), // GFIconButton( // onPressed: () {}, diff --git a/example/pubspec.lock b/example/pubspec.lock index 079bd9a7..328323fb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,48 +1,41 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -50,13 +43,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" cupertino_icons: dependency: "direct main" description: @@ -64,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -93,13 +86,6 @@ packages: relative: true source: path version: "1.1.1" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" matcher: dependency: transitive description: @@ -120,7 +106,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.0" path_drawing: dependency: transitive description: @@ -135,13 +121,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" petitparser: dependency: transitive description: @@ -156,13 +135,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" sky_engine: dependency: transitive description: flutter @@ -174,7 +146,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -209,7 +181,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: @@ -260,5 +232,5 @@ packages: source: hosted version: "3.5.0" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.6.0 <3.0.0" flutter: ">=1.12.8 <2.0.0" diff --git a/lib/components/appbar/gf_appbar.dart b/lib/components/appbar/gf_appbar.dart index d8c6e335..d8905d0e 100644 --- a/lib/components/appbar/gf_appbar.dart +++ b/lib/components/appbar/gf_appbar.dart @@ -321,9 +321,9 @@ class _GFAppBarState extends State { IconThemeData actionsIconTheme = widget.actionsIconTheme ?? appBarTheme.actionsIconTheme ?? overallIconTheme; - TextStyle centerStyle = widget.textTheme?.headline1 ?? - appBarTheme.textTheme?.headline1 ?? - theme.primaryTextTheme.headline1; + TextStyle centerStyle = widget.textTheme?.headline5 ?? + appBarTheme.textTheme?.headline5 ?? + theme.primaryTextTheme.headline5; TextStyle sideStyle = widget.textTheme?.bodyText1 ?? appBarTheme.textTheme?.bodyText1 ?? theme.primaryTextTheme.bodyText1; diff --git a/lib/components/checkbox/gf_checkbox.dart b/lib/components/checkbox/gf_checkbox.dart index ada0aa6b..ca33dbfb 100644 --- a/lib/components/checkbox/gf_checkbox.dart +++ b/lib/components/checkbox/gf_checkbox.dart @@ -63,6 +63,7 @@ class GFCheckbox extends StatefulWidget { } class _GFCheckboxState extends State { + bool get enabled => widget.onChanged != null; bool isSelected = false; @override @@ -81,48 +82,51 @@ class _GFCheckboxState extends State { } @override - Widget build(BuildContext context) => InkWell( - onTap: onStatusChange, - child: Container( - height: widget.size, - width: widget.size, - decoration: BoxDecoration( - color: isSelected - ? widget.type == GFCheckboxType.custom - ? Colors.white - : widget.activebgColor - : widget.inactivebgColor, - borderRadius: widget.type == GFCheckboxType.basic - ? BorderRadius.circular(3) - : widget.type == GFCheckboxType.circle - ? BorderRadius.circular(50) - : BorderRadius.zero, - border: Border.all( - color: isSelected - ? widget.type == GFCheckboxType.custom - ? Colors.black87 - : widget.activeBorderColor - : widget.inactiveBorderColor)), - child: isSelected - ? widget.type == GFCheckboxType.custom - ? Stack( - children: [ - Container( - alignment: Alignment.center, - ), - Container( - margin: const EdgeInsets.all(5), - alignment: Alignment.center, - width: widget.size * 0.8, - height: widget.size * 0.8, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: widget.custombgColor), - ) - ], - ) - : widget.activeIcon - : widget.inactiveIcon, + Widget build(BuildContext context) => FocusableActionDetector( + enabled: enabled, + child: InkWell( + onTap: onStatusChange, + child: Container( + height: widget.size, + width: widget.size, + decoration: BoxDecoration( + color: enabled ? isSelected + ? widget.type == GFCheckboxType.custom + ? Colors.white + : widget.activebgColor + : widget.inactivebgColor : Colors.grey, + borderRadius: widget.type == GFCheckboxType.basic + ? BorderRadius.circular(3) + : widget.type == GFCheckboxType.circle + ? BorderRadius.circular(50) + : BorderRadius.zero, + border: Border.all( + color: isSelected + ? widget.type == GFCheckboxType.custom + ? Colors.black87 + : widget.activeBorderColor + : widget.inactiveBorderColor)), + child: isSelected + ? widget.type == GFCheckboxType.custom + ? Stack( + children: [ + Container( + alignment: Alignment.center, + ), + Container( + margin: const EdgeInsets.all(5), + alignment: Alignment.center, + width: widget.size * 0.8, + height: widget.size * 0.8, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: widget.custombgColor), + ) + ], + ) + : widget.activeIcon + : widget.inactiveIcon, + ), ), - ); + ); } diff --git a/pubspec.lock b/pubspec.lock index 67a7df16..4211cac5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,62 +1,48 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" - collection: + version: "1.1.3" + clock: dependency: transitive description: - name: collection + name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" - convert: + version: "1.0.1" + collection: dependency: transitive description: - name: convert + name: collection url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" - crypto: + version: "1.14.12" + fake_async: dependency: transitive description: - name: crypto + name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -67,13 +53,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" matcher: dependency: transitive description: @@ -94,28 +73,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.7.0" sky_engine: dependency: transitive description: flutter @@ -127,7 +85,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -162,7 +120,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.11" + version: "0.2.15" typed_data: dependency: transitive description: @@ -177,12 +135,5 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.5.0" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.6.0 <3.0.0"