diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json index d4e14b2..e186749 100644 --- a/.fvm/fvm_config.json +++ b/.fvm/fvm_config.json @@ -1,4 +1,4 @@ { - "flutterSdkVersion": "3.0.0", + "flutterSdkVersion": "3.12.0", "flavors": {} } \ No newline at end of file diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 0000000..2770e1b --- /dev/null +++ b/.fvmrc @@ -0,0 +1,4 @@ +{ + "flutter": "3.12.0", + "flavors": {} +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b8a2674..588e1f8 100644 --- a/.gitignore +++ b/.gitignore @@ -73,4 +73,5 @@ build/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 -.fvm/flutter_sdk +.fvm/ +!.fvm/fvm_config.json diff --git a/.pubignore b/.pubignore index 5d07f85..1b484c4 100644 --- a/.pubignore +++ b/.pubignore @@ -1 +1,2 @@ -sample_proj/ \ No newline at end of file +sample_proj/ +.fvm/ \ No newline at end of file diff --git a/.run/main.dart.run.xml b/.run/main.dart.run.xml index 34f229c..7acab33 100644 --- a/.run/main.dart.run.xml +++ b/.run/main.dart.run.xml @@ -1,5 +1,5 @@ - + diff --git a/CHANGELOG.md b/CHANGELOG.md index e1e66ab..1d38588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,18 @@ +## 1.0.2 - 18/7/2023 + +* Navigate to next year on reach last month of current year +* Update _intl_ to ^0.19.0 + +* ## 1.0.1 - 18/7/2023 + +* Fixed small Overflow issues from last build + ## 1.0.0 - 10/7/2023 * Updated min dart version to 3.0.0 * Changed color scheme primaryVariant to outline -* Added implmentation to show weekday +* Added implementation to show weekday + ### Bug Fixes * Adjusted max height calculation for the picker diff --git a/lib/date_ranger.dart b/lib/date_ranger.dart index a81fd5a..83f2c86 100644 --- a/lib/date_ranger.dart +++ b/lib/date_ranger.dart @@ -127,7 +127,7 @@ class DateRanger extends StatefulWidget { this.showDoubleTapInfo = true, this.minYear = 1940, this.maxYear = 2100, - this.showWeekDay = true, + this.showWeekDay = false, }) : super(key: key); @override @@ -189,119 +189,121 @@ class _DateRangerState extends State outline: widget.borderColors)), child: Column( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - height: 55, - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - pickerOutput(), - if (widget.rangerType == DateRangerType.range) ...[ - Center( - child: SizedBox( - width: 32, - child: Divider( - endIndent: 12, - indent: 12, - thickness: 2, - ))), - pickerOutput(false) - ], - ], - ), - ), - ValueListenableBuilder( - valueListenable: showInfo, - builder: (context, value, child) => AnimatedOpacity( - duration: Duration(seconds: 2), - opacity: value ? 1 : 0, - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 6, horizontal: 4), - child: Text( - "Double tap to find date", - textAlign: TextAlign.center, - style: TextStyle( - color: Theme.of(context).colorScheme.primary, - fontSize: 12), - ), - )), - ), LayoutBuilder( builder: (context, constraints) { - var sevenDaysWidth = - itemWidth * 7 + (widget.horizontalPadding * 2); - var width = widget.showWeekDay ? sevenDaysWidth : double.infinity; + var sevenDaysWidth = itemWidth * 7 + (widget.horizontalPadding * 2); + var width = widget.showWeekDay ? sevenDaysWidth : null; return Container( - constraints: BoxConstraints( - maxHeight: calculateHeight(constraints), - /*maxWidth: width, - minWidth: width*/), width: width, - margin: EdgeInsets.only(bottom: 26), - padding: EdgeInsets.symmetric( - horizontal: widget.horizontalPadding, - vertical: widget.verticalPadding) - .copyWith(top: 0), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.background, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow(color: Colors.black12.withOpacity(0.6)) - ]), - child: InheritedRanger( - selectingStart: selectingStart, - activeYear: activeYear, - tabController: tabController, - rangerType: widget.rangerType, - activeTab: activeTab, - dateRange: dateRange, - navKey: navKey, - itemHeight: widget.itemHeight, - itemWidth: itemWidth, - runSpacing: widget.runSpacing, - activeDateBottomSpace: widget.activeDateBottomSpace, - activeDateFontSize: widget.activeDateFontSize, - minYear: widget.minYear, - maxYear: widget.maxYear, - showWeekday: widget.showWeekDay, - child: Navigator( - key: navKey, - onGenerateRoute: (settings) { - Widget widget; - if (settings.name == "/") - widget = PrimaryPage( - onNewDate: onNewDate, - onRangeChanged: onRangeChanged, - onError: onError, - ); - else - widget = SecondaryPage( - dateTime: settings.arguments as DateTime); - return MaterialPageRoute(builder: (context) => widget); - }, - ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + pickerOutput(), + if (widget.rangerType == DateRangerType.range) ...[ + SizedBox( + width: 32, + child: Divider( + endIndent: 12, + indent: 12, + thickness: 2, + )), + pickerOutput(false) + ], + ], + ), + ValueListenableBuilder( + valueListenable: showInfo, + builder: (context, value, child) => AnimatedOpacity( + duration: Duration(seconds: 2), + opacity: value ? 1 : 0, + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 6, horizontal: 4), + child: Text( + "Double tap to find date", + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + fontSize: 12), + ), + )), + ), + Container( + constraints: + BoxConstraints(maxHeight: calculateHeight(constraints)), + margin: EdgeInsets.only(bottom: 26), + padding: EdgeInsets.symmetric( + horizontal: widget.horizontalPadding, + vertical: widget.verticalPadding) + .copyWith(top: 0), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.background, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow(color: Colors.black12.withOpacity(0.6)) + ]), + child: InheritedRanger( + selectingStart: selectingStart, + activeYear: activeYear, + tabController: tabController, + rangerType: widget.rangerType, + activeTab: activeTab, + dateRange: dateRange, + navKey: navKey, + itemHeight: widget.itemHeight, + itemWidth: itemWidth, + runSpacing: widget.runSpacing, + activeDateBottomSpace: widget.activeDateBottomSpace, + activeDateFontSize: widget.activeDateFontSize, + minYear: widget.minYear, + maxYear: widget.maxYear, + showWeekday: widget.showWeekDay, + child: Navigator( + key: navKey, + onGenerateRoute: (settings) { + Widget widget; + if (settings.name == "/") + widget = PrimaryPage( + onNewDate: onNewDate, + onRangeChanged: onRangeChanged, + onError: onError, + ); + else + widget = SecondaryPage( + dateTime: settings.arguments as DateTime); + return MaterialPageRoute(builder: (context) => widget); + }, + ), + ), + ), + ValueListenableBuilder( + valueListenable: errorText, + builder: (context, value, child) => AnimatedSwitcher( + duration: Duration(milliseconds: 300), + reverseDuration: Duration(seconds: 2), + child: value.isEmpty + ? SizedBox( + height: 16, + ) + : Text( + value, + style: TextStyle( + color: + Theme.of(context).colorScheme.error, + fontSize: 14), + ), + )), + ], ), ); }, ), - ValueListenableBuilder( - valueListenable: errorText, - builder: (context, value, child) => AnimatedSwitcher( - duration: Duration(milliseconds: 300), - reverseDuration: Duration(seconds: 2), - child: value.isEmpty - ? SizedBox( - height: 16, - ) - : Text( - value, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - fontSize: 14), - ), - )), ], ), ); @@ -322,7 +324,7 @@ class _DateRangerState extends State final sumRowsHeight = (numRows * widget.itemHeight) + sumRunSpace; - final height = widget.activeDateFontSize + + final height = (widget.activeDateFontSize * 1.5) + widget.activeDateBottomSpace + sumRowsHeight + (widget.verticalPadding * 2); @@ -384,6 +386,7 @@ class _DateRangerState extends State ? CrossAxisAlignment.start : CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, children: [ Text( isRange ? "${start ? "Start" : "End"} date" : "Date", diff --git a/lib/src/primary_page.dart b/lib/src/primary_page.dart index 20bfa18..14fa323 100644 --- a/lib/src/primary_page.dart +++ b/lib/src/primary_page.dart @@ -35,7 +35,17 @@ class _PrimaryPageState extends State { var tabDate = DateTime(ranger.activeYear, value + 1); return Row( children: [ - chevron(active: value > 0), + chevron( + active: tabDate.year >= ranger.minYear, + onTap: () { + if (value > 0) { + ranger.tabController + .animateTo(ranger.tabController.index + -1); + } else { + widget.onNewDate + .call(tabDate.subtract(Duration(days: 1))); + } + }), InkWell( onTap: () async { var newDate = await ranger.navKey.currentState! @@ -55,7 +65,17 @@ class _PrimaryPageState extends State { ), ), ), - chevron(left: false, active: value < 11) + chevron( + left: false, + active: tabDate.year <= ranger.maxYear, + onTap: () { + if (value < 11) { + ranger.tabController + .animateTo(ranger.tabController.index + 1); + } else { + widget.onNewDate.call(tabDate.add(Duration(days: 31))); + } + }) ], ); }, @@ -73,16 +93,14 @@ class _PrimaryPageState extends State { ); } - Widget chevron({bool left = true, bool active = true}) { + Widget chevron( + {bool left = true, bool active = true, required VoidCallback onTap}) { return Expanded( child: AnimatedOpacity( opacity: active ? 1 : 0.2, duration: Duration(milliseconds: 100), child: InkWell( - onTap: active - ? () => ranger.tabController - .animateTo(ranger.tabController.index + (left ? -1 : 1)) - : null, + onTap: active ? onTap : null, child: Padding( padding: const EdgeInsets.only(top: 24), child: Align( diff --git a/lib/src/secondary_page.dart b/lib/src/secondary_page.dart index 62901b7..636651c 100644 --- a/lib/src/secondary_page.dart +++ b/lib/src/secondary_page.dart @@ -1,23 +1,31 @@ part of '../date_ranger.dart'; -class SecondaryPage extends StatelessWidget { +class SecondaryPage extends StatefulWidget { final DateTime dateTime; static final String route = "secondary"; SecondaryPage({Key? key, required this.dateTime}) : super(key: key); - late final pickedDate = ValueNotifier(dateTime); - late var years = List.generate( + @override + State createState() => _SecondaryPageState(); +} + +class _SecondaryPageState extends State { + late final pickedDate = ValueNotifier(widget.dateTime); + + late final years = List.generate( ranger.maxYear - ranger.minYear + 1, (index) => ranger.minYear + index); - late var yearController = FixedExtentScrollController( - initialItem: years.indexWhere((element) => element == dateTime.year)); - late var monthController = - FixedExtentScrollController(initialItem: dateTime.month - 1); - late InheritedRanger ranger; + + late final yearController = FixedExtentScrollController( + initialItem: years.indexWhere((element) => element == widget.dateTime.year)); + + late final monthController = + FixedExtentScrollController(initialItem: widget.dateTime.month - 1); + + late final InheritedRanger ranger = InheritedRanger.of(context); @override Widget build(BuildContext context) { - ranger = InheritedRanger.of(context); return ValueListenableBuilder( valueListenable: pickedDate, builder: (context, date, child) => Column( diff --git a/pubspec.lock b/pubspec.lock index 47084c6..93f5700 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -63,10 +63,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" js: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index cabc571..35462d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: date_ranger description: A date picker for flutter apps to pick single dates and date ranges -version: 1.0.0 +version: 1.0.2 homepage: https://github.com/funyin/date_ranger environment: @@ -10,7 +10,7 @@ environment: dependencies: flutter: sdk: flutter - intl: ^0.18.1 + intl: ^0.19.0 dev_dependencies: flutter_test: diff --git a/sample_proj/.fvm/fvm_config.json b/sample_proj/.fvm/fvm_config.json deleted file mode 100644 index e186749..0000000 --- a/sample_proj/.fvm/fvm_config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "flutterSdkVersion": "3.12.0", - "flavors": {} -} \ No newline at end of file diff --git a/sample_proj/.fvmrc b/sample_proj/.fvmrc new file mode 100644 index 0000000..2770e1b --- /dev/null +++ b/sample_proj/.fvmrc @@ -0,0 +1,4 @@ +{ + "flutter": "3.12.0", + "flavors": {} +} \ No newline at end of file diff --git a/sample_proj/.gitignore b/sample_proj/.gitignore index 24476c5..6b389b2 100644 --- a/sample_proj/.gitignore +++ b/sample_proj/.gitignore @@ -42,3 +42,5 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release +.fvm/ +!.fvm/fvm_config.json diff --git a/sample_proj/ios/Runner.xcodeproj/project.pbxproj b/sample_proj/ios/Runner.xcodeproj/project.pbxproj index 6713d70..92d589e 100644 --- a/sample_proj/ios/Runner.xcodeproj/project.pbxproj +++ b/sample_proj/ios/Runner.xcodeproj/project.pbxproj @@ -8,12 +8,12 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,6 +42,8 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -53,8 +55,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; - 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -68,6 +68,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -79,14 +87,6 @@ name = Flutter; sourceTree = ""; }; - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( @@ -129,7 +129,6 @@ buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( 331C807D294A63A400263BE5 /* Sources */, - 331C807E294A63A400263BE5 /* Frameworks */, 331C807F294A63A400263BE5 /* Resources */, ); buildRules = ( @@ -361,13 +360,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = TL6UUBVUR7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.sampleProj; + PRODUCT_BUNDLE_IDENTIFIER = com.initbase.data; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -377,7 +377,6 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -395,7 +394,6 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -411,7 +409,6 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -539,13 +536,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = TL6UUBVUR7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.sampleProj; + PRODUCT_BUNDLE_IDENTIFIER = com.initbase.data; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -561,13 +559,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = TL6UUBVUR7; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.sampleProj; + PRODUCT_BUNDLE_IDENTIFIER = com.initbase.data; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/sample_proj/ios/Runner/Info.plist b/sample_proj/ios/Runner/Info.plist index 68da157..a4851db 100644 --- a/sample_proj/ios/Runner/Info.plist +++ b/sample_proj/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -24,6 +26,8 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -43,9 +47,5 @@ UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - diff --git a/sample_proj/lib/main.dart b/sample_proj/lib/main.dart index 72f6b88..b8bc754 100644 --- a/sample_proj/lib/main.dart +++ b/sample_proj/lib/main.dart @@ -52,6 +52,8 @@ class _MyHomePageState extends State { }); } + DateRangerType selectedType = DateRangerType.values.first; + @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -74,10 +76,31 @@ class _MyHomePageState extends State { ), body: ListView( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16), - children: const [ - DateRanger( - showWeekDay: false, + children: [ + DateRanger( + showWeekDay: true, + rangerType: selectedType, ), + const Text("Ranger Type"), + const SizedBox(height: 10), + ToggleButtons( + isSelected: + DateRangerType.values.map((e) => e == selectedType).toList(), + onPressed: (index) { + setState(() { + selectedType = DateRangerType.values[index]; + }); + }, + + children: DateRangerType.values + .map( + (e) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 6), + child: Text(e.name.toUpperCase()), + ), + ) + .toList(), + ) ], ), floatingActionButton: FloatingActionButton( diff --git a/sample_proj/pubspec.lock b/sample_proj/pubspec.lock index a207ff8..1d61a87 100644 --- a/sample_proj/pubspec.lock +++ b/sample_proj/pubspec.lock @@ -55,7 +55,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.1" fake_async: dependency: transitive description: @@ -86,10 +86,10 @@ packages: dependency: transitive description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" js: dependency: transitive description: