fixes with callback
|
@ -4,7 +4,7 @@
|
||||||
# This file should be version controlled.
|
# This file should be version controlled.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
@ -13,26 +13,26 @@ project_type: app
|
||||||
migration:
|
migration:
|
||||||
platforms:
|
platforms:
|
||||||
- platform: root
|
- platform: root
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: android
|
- platform: android
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: ios
|
- platform: ios
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: linux
|
- platform: linux
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: macos
|
- platform: macos
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: web
|
- platform: web
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
- platform: windows
|
- platform: windows
|
||||||
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
|
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
|
||||||
|
|
||||||
# User provided section
|
# User provided section
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.example.example"
|
applicationId "com.iconica.example"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
|
||||||
minSdkVersion flutter.minSdkVersion
|
minSdkVersion flutter.minSdkVersion
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.example">
|
package="com.iconica.example">
|
||||||
<!-- The INTERNET permission is required for development. Specifically,
|
<!-- The INTERNET permission is required for development. Specifically,
|
||||||
the Flutter tool needs it to communicate with the running application
|
the Flutter tool needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.example">
|
package="com.iconica.example">
|
||||||
<application
|
<application
|
||||||
android:label="example"
|
android:label="example"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.example.example
|
package com.iconica.example
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.example">
|
package="com.iconica.example">
|
||||||
<!-- The INTERNET permission is required for development. Specifically,
|
<!-- The INTERNET permission is required for development. Specifically,
|
||||||
the Flutter tool needs it to communicate with the running application
|
the Flutter tool needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#Fri Jun 23 08:50:38 CEST 2017
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
@ -295,7 +295,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
PRODUCT_BUNDLE_IDENTIFIER = com.iconica.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
@ -424,7 +424,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
PRODUCT_BUNDLE_IDENTIFIER = com.iconica.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
@ -447,7 +447,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
|
PRODUCT_BUNDLE_IDENTIFIER = com.iconica.example;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|
|
@ -45,5 +45,7 @@
|
||||||
<false/>
|
<false/>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -6,7 +6,7 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
|
@ -14,88 +14,23 @@ class MyApp extends StatelessWidget {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
// This is the theme of your application.
|
|
||||||
//
|
|
||||||
// Try running your application with "flutter run". You'll see the
|
|
||||||
// application has a blue toolbar. Then, without quitting the app, try
|
|
||||||
// changing the primarySwatch below to Colors.green and then invoke
|
|
||||||
// "hot reload" (press "r" in the console where you ran "flutter run",
|
|
||||||
// or simply save your changes to "hot reload" in a Flutter IDE).
|
|
||||||
// Notice that the counter didn't reset back to zero; the application
|
|
||||||
// is not restarted.
|
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
),
|
),
|
||||||
home: MyHomePage(),
|
home: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Roster'),
|
||||||
|
),
|
||||||
|
body: const DatePickerDemo(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyHomePage extends StatelessWidget {
|
class DatePickerDemo extends StatelessWidget {
|
||||||
|
const DatePickerDemo({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return DateTimePicker(dateTimePickerTheme: const DateTimePickerTheme(),);
|
||||||
appBar: AppBar(title: Text('Rooster')),
|
|
||||||
body: DateTimePicker(
|
|
||||||
// header: Container(
|
|
||||||
// height: 100,
|
|
||||||
// width: MediaQuery.of(context).size.width,
|
|
||||||
// padding: const EdgeInsets.only(bottom: 10),
|
|
||||||
// child: Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// const SizedBox(
|
|
||||||
// width: 160,
|
|
||||||
// height: 34,
|
|
||||||
// child: Center(
|
|
||||||
// child: Text(
|
|
||||||
// 'Persoonlijk',
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w900,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(
|
|
||||||
// width: 4,
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// width: 160,
|
|
||||||
// height: 34,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: const Color(0xFF00273D),
|
|
||||||
// borderRadius: const BorderRadius.all(
|
|
||||||
// Radius.circular(10),
|
|
||||||
// ),
|
|
||||||
// boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: const Color(0xFF000000).withOpacity(0.50),
|
|
||||||
// offset: const Offset(0, 6),
|
|
||||||
// blurRadius: 9,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// child: const Center(
|
|
||||||
// child: Text(
|
|
||||||
// 'Teamplanning',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontSize: 16,
|
|
||||||
// fontWeight: FontWeight.w900,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
disabledDates: [DateTime(2022, 8, 26), DateTime(2022, 8, 27)],
|
|
||||||
markedDates: [DateTime(2022, 8, 28), DateTime(2022, 8, 29)],
|
|
||||||
disabledTimes: const [TimeOfDay(hour: 12, minute: 0)],
|
|
||||||
pickTime: true,
|
|
||||||
child: Container(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
|
||||||
set(BINARY_NAME "example")
|
set(BINARY_NAME "example")
|
||||||
# The unique GTK application identifier for this application. See:
|
# The unique GTK application identifier for this application. See:
|
||||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||||
set(APPLICATION_ID "com.example.example")
|
set(APPLICATION_ID "com.iconica.example")
|
||||||
|
|
||||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||||
# versions of CMake.
|
# versions of CMake.
|
||||||
|
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 101 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -8,7 +8,7 @@
|
||||||
PRODUCT_NAME = example
|
PRODUCT_NAME = example
|
||||||
|
|
||||||
// The application's bundle identifier
|
// The application's bundle identifier
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.example
|
PRODUCT_BUNDLE_IDENTIFIER = com.iconica.example
|
||||||
|
|
||||||
// The copyright displayed in application information
|
// The copyright displayed in application information
|
||||||
PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
|
PRODUCT_COPYRIGHT = Copyright © 2022 com.iconica. All rights reserved.
|
||||||
|
|
|
@ -1,91 +1,24 @@
|
||||||
name: example
|
name: datetime_picker_example
|
||||||
description: A new Flutter project.
|
description: DateTimePicker Widget
|
||||||
|
|
||||||
# The following line prevents the package from being accidentally published to
|
publish_to: 'none'
|
||||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|
||||||
|
|
||||||
# The following defines the version and build number for your application.
|
|
||||||
# A version number is three numbers separated by dots, like 1.2.43
|
|
||||||
# followed by an optional build number separated by a +.
|
|
||||||
# Both the version and the builder number may be overridden in flutter
|
|
||||||
# build by specifying --build-name and --build-number, respectively.
|
|
||||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
|
||||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
|
||||||
# Read more about iOS versioning at
|
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.6 <3.0.0"
|
sdk: ">=2.17.6 <3.0.0"
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
|
||||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
|
||||||
# dependencies can be manually updated by changing the version numbers below to
|
|
||||||
# the latest version available on pub.dev. To see which dependencies have newer
|
|
||||||
# versions available, run `flutter pub outdated`.
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
cupertino_icons: ^1.0.2
|
||||||
flutter_date_time_picker:
|
flutter_date_time_picker:
|
||||||
path: ../
|
path: ../
|
||||||
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
|
||||||
cupertino_icons: ^1.0.2
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# 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
|
|
||||||
# package. See that file for information about deactivating specific lint
|
|
||||||
# rules and activating additional ones.
|
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
|
||||||
|
|
||||||
# The following section is specific to Flutter packages.
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
# The following line ensures that the Material Icons font is
|
|
||||||
# included with your application, so that you can use the icons in
|
|
||||||
# the material Icons class.
|
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
|
||||||
# assets:
|
|
||||||
# - images/a_dot_burr.jpeg
|
|
||||||
# - images/a_dot_ham.jpeg
|
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
|
||||||
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
|
||||||
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
|
||||||
# - family: Schyler
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
|
||||||
# style: italic
|
|
||||||
# - family: Trajan Pro
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/TrajanPro.ttf
|
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
|
||||||
# weight: 700
|
|
||||||
#
|
|
||||||
# For details regarding fonts from package dependencies,
|
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
import 'package:example/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
|
||||||
expect(find.text('0'), findsOneWidget);
|
|
||||||
expect(find.text('1'), findsNothing);
|
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
|
||||||
expect(find.text('0'), findsNothing);
|
|
||||||
expect(find.text('1'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
|
||||||
# that need different build settings.
|
# that need different build settings.
|
||||||
apply_standard_settings(${BINARY_NAME})
|
apply_standard_settings(${BINARY_NAME})
|
||||||
|
|
||||||
|
# Add preprocessor definitions for the build version.
|
||||||
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
|
||||||
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
|
||||||
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
|
||||||
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
|
||||||
|
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
|
||||||
|
|
||||||
# Disable Windows macros that collide with C++ standard library functions.
|
# Disable Windows macros that collide with C++ standard library functions.
|
||||||
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
||||||
|
|
||||||
|
|
|
@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
|
||||||
// Version
|
// Version
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef FLUTTER_BUILD_NUMBER
|
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
|
||||||
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
|
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
|
||||||
#else
|
#else
|
||||||
#define VERSION_AS_NUMBER 1,0,0
|
#define VERSION_AS_NUMBER 1,0,0,0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FLUTTER_BUILD_NAME
|
#if defined(FLUTTER_VERSION)
|
||||||
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
|
#define VERSION_AS_STRING FLUTTER_VERSION
|
||||||
#else
|
#else
|
||||||
#define VERSION_AS_STRING "1.0.0"
|
#define VERSION_AS_STRING "1.0.0"
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,11 +89,11 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904e4"
|
BLOCK "040904e4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "com.example" "\0"
|
VALUE "CompanyName", "com.iconica" "\0"
|
||||||
VALUE "FileDescription", "example" "\0"
|
VALUE "FileDescription", "example" "\0"
|
||||||
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
||||||
VALUE "InternalName", "example" "\0"
|
VALUE "InternalName", "example" "\0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
|
VALUE "LegalCopyright", "Copyright (C) 2022 com.iconica. All rights reserved." "\0"
|
||||||
VALUE "OriginalFilename", "example.exe" "\0"
|
VALUE "OriginalFilename", "example.exe" "\0"
|
||||||
VALUE "ProductName", "example" "\0"
|
VALUE "ProductName", "example" "\0"
|
||||||
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</application>
|
</application>
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<application>
|
<application>
|
||||||
<!-- Windows 10 -->
|
<!-- Windows 10 and Windows 11 -->
|
||||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
<!-- Windows 8.1 -->
|
<!-- Windows 8.1 -->
|
||||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
|
|
@ -2,3 +2,8 @@ library flutter_date_time_picker;
|
||||||
|
|
||||||
export 'src/date_time_picker.dart';
|
export 'src/date_time_picker.dart';
|
||||||
export 'src/enums/date_box_shape.dart';
|
export 'src/enums/date_box_shape.dart';
|
||||||
|
export 'src/models/date_box_base_theme.dart';
|
||||||
|
export 'src/models/date_box_disabled_theme.dart';
|
||||||
|
export 'src/models/date_box_highlight_theme.dart';
|
||||||
|
export 'src/models/date_box_selected_theme.dart';
|
||||||
|
export 'src/models/date_time_picker_theme.dart';
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/src/enums/date_box_shape.dart';
|
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||||
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
||||||
import 'package:flutter_date_time_picker/src/widgets/month_date_time_picker.dart/month_date_time_picker_sheet.dart';
|
import 'package:flutter_date_time_picker/src/widgets/month_date_time_picker.dart/month_date_time_picker_sheet.dart';
|
||||||
import 'package:flutter_date_time_picker/src/widgets/week_date_time_picker/week_date_time_picker_sheet.dart';
|
import 'package:flutter_date_time_picker/src/widgets/week_date_time_picker/week_date_time_picker_sheet.dart';
|
||||||
|
@ -9,27 +9,42 @@ import 'package:intl/date_symbol_data_local.dart';
|
||||||
|
|
||||||
/// A widget that displays a date picker from a sheet form the top of the screen.
|
/// A widget that displays a date picker from a sheet form the top of the screen.
|
||||||
/// This sheet displays initialy displays a week of days but can be dragged down to show full months.
|
/// This sheet displays initialy displays a week of days but can be dragged down to show full months.
|
||||||
/// Both views can be dragged sideways to show the next or previous wweek/month.
|
/// Both views can be dragged sideways to show the next or previous week/month.
|
||||||
///
|
///
|
||||||
/// The child will be the [Widget] that is displayed underneath the date picker in the stack.
|
/// The child will be the [Widget] that is displayed underneath the date picker in the stack.
|
||||||
///
|
///
|
||||||
|
///
|
||||||
|
/// [initialDate] indicates the starting date. Default is [DateTime.now()
|
||||||
|
///
|
||||||
|
/// [pickTime] is a [bool] that determines if the user is able to pick a time after picking a date.
|
||||||
|
/// true will always tirgger a [TimePickerDialog].
|
||||||
|
/// false will nvever trigger a [TimePickerDialog]. This is default.
|
||||||
|
///
|
||||||
|
/// [use24HourFormat] is a [bool] to set de clock on [TimePickerDialog] to a fixed 24 or 12-hour format.
|
||||||
|
/// By default this gets determined by the [Locale] on the device.
|
||||||
|
///
|
||||||
|
/// [dateTimePickerTheme] is used the set the global theme of the [DateTimePicker]
|
||||||
|
///
|
||||||
/// The header [Widget] will be displayed above the date picker in the modal sheet in a column.
|
/// The header [Widget] will be displayed above the date picker in the modal sheet in a column.
|
||||||
///
|
///
|
||||||
/// onTapDay is a callback that provides the taped date as a [DateTime] object.
|
/// [onTapDay] is a callback that provides the taped date as a [DateTime] object.
|
||||||
///
|
///
|
||||||
/// highlightToday is a [bool] that determines which day shall we highlighted.
|
/// [highlightToday] is a [bool] that determines which day shall we highlighted.
|
||||||
/// true will always highlight the current date. This is standard.
|
/// true will always highlight the current date. This is standard.
|
||||||
/// false will highlight the currently selected date by either the initial date or the one chosen by the user.
|
/// false will highlight the currently selected date by either the initial date or the one chosen by the user.
|
||||||
/// [highlighColor] is used as background for the highlighted day.
|
/// final Widget? child;
|
||||||
/// [toggleableActiveColor] is used for the text color when highlighted.
|
///
|
||||||
/// [disabledColor] is used for the text color when not highlighted.
|
/// [markedDates] contain the dates [DateTime] that will be marked in the picker by a small dot.
|
||||||
|
///
|
||||||
|
/// [disabledDates] contain the dates [DateTime] that will be disabled and cannot be interacted with whatsoever.
|
||||||
|
///
|
||||||
|
/// [disabledTimes] contain the time [TimeOfDay] that cannot be picked in the [TimePickerDialog].
|
||||||
///
|
///
|
||||||
/// markedDates contain the dates [DateTime] that will be marked in the picker by a small dot.
|
|
||||||
/// [indicatorColor] is used for the color of the dot.
|
|
||||||
///
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
/// ```dart
|
/// ```dart
|
||||||
/// ShellDatePicker(
|
/// DatePicker(
|
||||||
|
/// dateTimePickerTheme: const DateTimePickerTheme()
|
||||||
/// initialDate: selectedDate,
|
/// initialDate: selectedDate,
|
||||||
/// highlightToday: false,
|
/// highlightToday: false,
|
||||||
/// onTapDay: (date) {
|
/// onTapDay: (date) {
|
||||||
|
@ -112,35 +127,29 @@ import 'package:intl/date_symbol_data_local.dart';
|
||||||
///```
|
///```
|
||||||
class DateTimePicker extends StatefulWidget {
|
class DateTimePicker extends StatefulWidget {
|
||||||
DateTimePicker({
|
DateTimePicker({
|
||||||
required this.child,
|
this.dateTimePickerTheme = const DateTimePickerTheme(),
|
||||||
this.weekDateBoxSize = 35,
|
|
||||||
this.monthDateBoxSize = 45,
|
|
||||||
this.header,
|
this.header,
|
||||||
this.onTapDay,
|
this.onTapDay,
|
||||||
this.highlightToday = true,
|
this.highlightToday = true,
|
||||||
bool? use24HourFormat,
|
bool? use24HourFormat,
|
||||||
this.pickTime = false,
|
this.pickTime = false,
|
||||||
this.dateBoxSize,
|
|
||||||
this.dateBoxShape = DateBoxShape.roundedRectangle,
|
|
||||||
this.initialDate,
|
this.initialDate,
|
||||||
this.markedDates,
|
this.markedDates,
|
||||||
this.disabledDates,
|
this.disabledDates,
|
||||||
this.disabledTimes,
|
this.disabledTimes,
|
||||||
|
this.child,
|
||||||
super.key,
|
super.key,
|
||||||
}) {
|
}) {
|
||||||
alwaysUse24HourFormat = use24HourFormat ?? useTimeFormatBasedOnLocale();
|
alwaysUse24HourFormat = use24HourFormat ?? useTimeFormatBasedOnLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Widget child;
|
final Widget? child;
|
||||||
|
final DateTimePickerTheme dateTimePickerTheme;
|
||||||
final Widget? header;
|
final Widget? header;
|
||||||
final Function(DateTime)? onTapDay;
|
final Function(DateTime)? onTapDay;
|
||||||
final bool highlightToday;
|
final bool highlightToday;
|
||||||
late final bool alwaysUse24HourFormat;
|
late final bool alwaysUse24HourFormat;
|
||||||
final bool pickTime;
|
final bool pickTime;
|
||||||
final double? dateBoxSize;
|
|
||||||
final DateBoxShape dateBoxShape;
|
|
||||||
final double weekDateBoxSize;
|
|
||||||
final double monthDateBoxSize;
|
|
||||||
final DateTime? initialDate;
|
final DateTime? initialDate;
|
||||||
final List<DateTime>? markedDates;
|
final List<DateTime>? markedDates;
|
||||||
final List<DateTime>? disabledDates;
|
final List<DateTime>? disabledDates;
|
||||||
|
@ -165,7 +174,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
highlightToday: widget.highlightToday,
|
highlightToday: widget.highlightToday,
|
||||||
alwaysUse24HourFormat: widget.alwaysUse24HourFormat,
|
alwaysUse24HourFormat: widget.alwaysUse24HourFormat,
|
||||||
pickTime: widget.pickTime,
|
pickTime: widget.pickTime,
|
||||||
dateBoxShape: widget.dateBoxShape,
|
theme: widget.dateTimePickerTheme,
|
||||||
header: widget.header,
|
header: widget.header,
|
||||||
markedDates: widget.markedDates,
|
markedDates: widget.markedDates,
|
||||||
disabledDates: widget.disabledDates,
|
disabledDates: widget.disabledDates,
|
||||||
|
@ -176,8 +185,6 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
);
|
);
|
||||||
|
|
||||||
_dateTimePickerController.addListener(() {
|
_dateTimePickerController.addListener(() {
|
||||||
print('BROWSING DATE: ${_dateTimePickerController.browsingDate}');
|
|
||||||
print('SELECTED DATE: ${_dateTimePickerController.selectedDate}');
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -193,7 +200,9 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
widget.child,
|
if (widget.child != null) ...[
|
||||||
|
widget.child!,
|
||||||
|
],
|
||||||
RotatedBox(
|
RotatedBox(
|
||||||
quarterTurns: 2,
|
quarterTurns: 2,
|
||||||
child: DraggableScrollableSheet(
|
child: DraggableScrollableSheet(
|
||||||
|
@ -201,7 +210,7 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
snap: true,
|
snap: true,
|
||||||
minChildSize: 0.2,
|
minChildSize: 0.2,
|
||||||
initialChildSize: 0.2,
|
initialChildSize: 0.2,
|
||||||
maxChildSize: 0.68,
|
maxChildSize: 0.6,
|
||||||
builder: (context, scrollController) {
|
builder: (context, scrollController) {
|
||||||
double dragSize =
|
double dragSize =
|
||||||
_dragController.isAttached ? _dragController.size : 0;
|
_dragController.isAttached ? _dragController.size : 0;
|
||||||
|
@ -233,12 +242,14 @@ class _DateTimePickerState extends State<DateTimePicker> {
|
||||||
? WeekDateTimePickerSheet(
|
? WeekDateTimePickerSheet(
|
||||||
dateTimePickerController:
|
dateTimePickerController:
|
||||||
_dateTimePickerController,
|
_dateTimePickerController,
|
||||||
weekDateBoxSize: widget.weekDateBoxSize,
|
weekDateBoxSize: widget
|
||||||
|
.dateTimePickerTheme.weekDateBoxSize,
|
||||||
)
|
)
|
||||||
: MonthDateTimePickerSheet(
|
: MonthDateTimePickerSheet(
|
||||||
dateTimePickerController:
|
dateTimePickerController:
|
||||||
_dateTimePickerController,
|
_dateTimePickerController,
|
||||||
monthDateBoxSize: widget.monthDateBoxSize,
|
monthDateBoxSize: widget
|
||||||
|
.dateTimePickerTheme.monthDateBoxSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
15
lib/src/models/date_box_base_theme.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/widgets.dart' show Color, TextStyle;
|
||||||
|
|
||||||
|
class DateBoxBaseTheme {
|
||||||
|
/// Default date theme.
|
||||||
|
const DateBoxBaseTheme(
|
||||||
|
this.backgroundColor,
|
||||||
|
this.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Background color of default date
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
/// The style of the date number.
|
||||||
|
final TextStyle? textStyle;
|
||||||
|
}
|
15
lib/src/models/date_box_current_theme.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/widgets.dart' show Color, TextStyle;
|
||||||
|
|
||||||
|
class DateBoxCurrentTheme {
|
||||||
|
/// Default date theme.
|
||||||
|
const DateBoxCurrentTheme(
|
||||||
|
this.backgroundColor,
|
||||||
|
this.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Background color of default date
|
||||||
|
final Color backgroundColor;
|
||||||
|
|
||||||
|
/// The style of the date number.
|
||||||
|
final TextStyle textStyle;
|
||||||
|
}
|
15
lib/src/models/date_box_disabled_theme.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/widgets.dart' show Color, TextStyle;
|
||||||
|
|
||||||
|
class DateBoxDisabledTheme {
|
||||||
|
/// Disabled date theme.
|
||||||
|
const DateBoxDisabledTheme(
|
||||||
|
this.backgroundColor,
|
||||||
|
this.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Background color of selected date.
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
/// The style of the date number.
|
||||||
|
final TextStyle? textStyle;
|
||||||
|
}
|
15
lib/src/models/date_box_highlight_theme.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/widgets.dart' show Color, TextStyle;
|
||||||
|
|
||||||
|
class DateBoxHighlightTheme {
|
||||||
|
/// Highlighted date theme.
|
||||||
|
const DateBoxHighlightTheme(
|
||||||
|
this.backgroundColor,
|
||||||
|
this.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Background color of highlighted date.
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
/// The style of the date number.
|
||||||
|
final TextStyle? textStyle;
|
||||||
|
}
|
15
lib/src/models/date_box_selected_theme.dart
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:flutter/widgets.dart' show Color, TextStyle;
|
||||||
|
|
||||||
|
class DateBoxSelectedTheme {
|
||||||
|
/// Selected date theme.
|
||||||
|
const DateBoxSelectedTheme(
|
||||||
|
this.backgroundColor,
|
||||||
|
this.textStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Background color of selected date.
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
|
/// The style of the date number.
|
||||||
|
final TextStyle? textStyle;
|
||||||
|
}
|
58
lib/src/models/date_time_picker_theme.dart
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_base_theme.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_disabled_theme.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_highlight_theme.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_selected_theme.dart';
|
||||||
|
|
||||||
|
class DateTimePickerTheme {
|
||||||
|
/// The [DateTimePickerTheme] to style [DateTimePicker] in. Define a custom shape for the dates and specifically style
|
||||||
|
/// a basic, hightlighted, selected and disabled date.
|
||||||
|
const DateTimePickerTheme({
|
||||||
|
this.weekDateBoxSize = 35,
|
||||||
|
this.monthDateBoxSize = 45,
|
||||||
|
this.markedIndicatorColor,
|
||||||
|
this.dateBoxShape = DateBoxShape.roundedRectangle,
|
||||||
|
this.baseTheme = const DateBoxBaseTheme(
|
||||||
|
Colors.white,
|
||||||
|
TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
|
this.highlightTheme = const DateBoxHighlightTheme(
|
||||||
|
Colors.blue,
|
||||||
|
TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
this.selectedTheme = const DateBoxSelectedTheme(
|
||||||
|
Color(0xFFBBDEFB),
|
||||||
|
TextStyle(color: Colors.blue),
|
||||||
|
),
|
||||||
|
this.disabledTheme = const DateBoxDisabledTheme(
|
||||||
|
Colors.grey,
|
||||||
|
TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
/// enum to define a shape dor the date. use [DateBoxShape.circle].
|
||||||
|
/// For a ciruclar date, [DateBoxShape.rectangle] for a plain box and [DateBoxShape.roundedRectangle] to het a rectangle with small rounded borders.
|
||||||
|
final DateBoxShape dateBoxShape;
|
||||||
|
|
||||||
|
/// This theme is used to style a default look for the dates.
|
||||||
|
final DateBoxBaseTheme baseTheme;
|
||||||
|
|
||||||
|
/// This theme is used for when a specific date is highlighted.
|
||||||
|
final DateBoxHighlightTheme highlightTheme;
|
||||||
|
|
||||||
|
/// This theme is used for when a specific date is slected by the user.
|
||||||
|
final DateBoxSelectedTheme selectedTheme;
|
||||||
|
|
||||||
|
/// This theme is used for when a specific date is disabled.
|
||||||
|
final DateBoxDisabledTheme disabledTheme;
|
||||||
|
|
||||||
|
/// Size of date box in a week view.
|
||||||
|
final double weekDateBoxSize;
|
||||||
|
|
||||||
|
/// Size of date box in a month view.
|
||||||
|
final double monthDateBoxSize;
|
||||||
|
|
||||||
|
/// The color used for a indicator for a marked date.
|
||||||
|
final Color? markedIndicatorColor;
|
||||||
|
}
|
|
@ -1,23 +1,21 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/src/enums/date_box_shape.dart';
|
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||||
|
|
||||||
class DateTimePickerController extends ChangeNotifier {
|
class DateTimePickerController extends ChangeNotifier {
|
||||||
DateTimePickerController({
|
DateTimePickerController({
|
||||||
|
required this.theme,
|
||||||
required this.highlightToday,
|
required this.highlightToday,
|
||||||
required this.alwaysUse24HourFormat,
|
required this.alwaysUse24HourFormat,
|
||||||
required this.pickTime,
|
required this.pickTime,
|
||||||
required this.dateBoxShape,
|
required this.browsingDate,
|
||||||
|
required this.selectedDate,
|
||||||
this.header,
|
this.header,
|
||||||
this.markedDates,
|
this.markedDates,
|
||||||
this.disabledDates,
|
this.disabledDates,
|
||||||
this.disabledTimes,
|
this.disabledTimes,
|
||||||
this.onTapDayCallBack,
|
this.onTapDayCallBack,
|
||||||
required this.browsingDate,
|
|
||||||
required this.selectedDate,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
final PageController _pageController = PageController(initialPage: 1);
|
final PageController _pageController = PageController(initialPage: 1);
|
||||||
|
|
||||||
final bool highlightToday;
|
final bool highlightToday;
|
||||||
|
@ -25,7 +23,7 @@ class DateTimePickerController extends ChangeNotifier {
|
||||||
|
|
||||||
final Widget? header;
|
final Widget? header;
|
||||||
|
|
||||||
final DateBoxShape dateBoxShape;
|
final DateTimePickerTheme theme;
|
||||||
|
|
||||||
final List<DateTime>? markedDates;
|
final List<DateTime>? markedDates;
|
||||||
final List<DateTime>? disabledDates;
|
final List<DateTime>? disabledDates;
|
||||||
|
@ -56,7 +54,7 @@ class DateTimePickerController extends ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTapDay(date) {
|
void onTapDay(DateTime date) {
|
||||||
browsingDate = date;
|
browsingDate = date;
|
||||||
selectedDate = date;
|
selectedDate = date;
|
||||||
|
|
||||||
|
@ -69,9 +67,7 @@ class DateTimePickerController extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController getPageController() {
|
PageController get pageController => _pageController;
|
||||||
return _pageController;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setBrowsingDate(DateTime date) {
|
void setBrowsingDate(DateTime date) {
|
||||||
browsingDate = date;
|
browsingDate = date;
|
||||||
|
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/src/enums/date_box_shape.dart';
|
import 'package:flutter_date_time_picker/src/enums/date_box_shape.dart';
|
||||||
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
||||||
import 'package:flutter_date_time_picker/src/extensions/time_of_day.dart';
|
import 'package:flutter_date_time_picker/src/extensions/time_of_day.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_current_theme.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||||
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
||||||
|
|
||||||
class MonthDateTimePicker extends StatelessWidget {
|
class MonthDateTimePicker extends StatelessWidget {
|
||||||
|
@ -37,7 +39,7 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
DateTime(date.year, date.month).daysInMonth() +
|
DateTime(date.year, date.month).daysInMonth() +
|
||||||
(daysToSkip >= 7 ? 0 : daysToSkip),
|
(daysToSkip >= 7 ? 0 : daysToSkip),
|
||||||
(index) {
|
(index) {
|
||||||
late Map<String, Color> calendarColors;
|
late DateBoxCurrentTheme currentDateBoxTheme;
|
||||||
|
|
||||||
int addedIndex = index;
|
int addedIndex = index;
|
||||||
|
|
||||||
|
@ -48,11 +50,8 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarColors = determineColors(
|
currentDateBoxTheme = determineCurrentDateBoxTheme(context,
|
||||||
context,
|
addedIndex, daysToSkip, dateTimePickerController.theme);
|
||||||
addedIndex,
|
|
||||||
daysToSkip,
|
|
||||||
);
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: isDisabled(
|
onTap: isDisabled(
|
||||||
|
@ -76,6 +75,8 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
addedIndex + 1 - daysToSkip,
|
addedIndex + 1 - daysToSkip,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
timeOfDay = const TimeOfDay(hour: 0, minute: 0);
|
||||||
|
|
||||||
if (dateTimePickerController.pickTime) {
|
if (dateTimePickerController.pickTime) {
|
||||||
timeOfDay = await displayTimePicker(
|
timeOfDay = await displayTimePicker(
|
||||||
context, dateTimePickerController);
|
context, dateTimePickerController);
|
||||||
|
@ -84,15 +85,35 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
if (timeOfDay != null &&
|
if (timeOfDay != null &&
|
||||||
timeOfDay.timeContainedIn(
|
timeOfDay.timeContainedIn(
|
||||||
dateTimePickerController.disabledTimes ?? [])) {
|
dateTimePickerController.disabledTimes ?? [])) {
|
||||||
} else {
|
showDialog(
|
||||||
timeOfDay = const TimeOfDay(hour: 0, minute: 0);
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: const Text('Verkeerde tijd gekozen'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: const <Widget>[
|
||||||
|
Text(
|
||||||
|
'De tijd die u wilt kiezen, is niet mogelijk, maak een andere keuze.'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime selectedDateTime = DateTime(
|
DateTime selectedDateTime = DateTime(
|
||||||
selectedDate.year,
|
selectedDate.year,
|
||||||
selectedDate.month,
|
selectedDate.month,
|
||||||
selectedDate.day,
|
selectedDate.day,
|
||||||
timeOfDay.hour,
|
timeOfDay!.hour,
|
||||||
timeOfDay.minute,
|
timeOfDay.minute,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -102,7 +123,7 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
margin:
|
margin:
|
||||||
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: calendarColors['backgroundColor'],
|
color: currentDateBoxTheme.backgroundColor,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
_determineBorderRadius(dateTimePickerController),
|
_determineBorderRadius(dateTimePickerController),
|
||||||
),
|
),
|
||||||
|
@ -111,13 +132,8 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text((addedIndex + 1 - daysToSkip).toString(),
|
||||||
(addedIndex + 1 - daysToSkip).toString(),
|
style: currentDateBoxTheme.textStyle),
|
||||||
style:
|
|
||||||
Theme.of(context).textTheme.bodyText1!.copyWith(
|
|
||||||
color: calendarColors['textColor'],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (shouldMark(
|
if (shouldMark(
|
||||||
addedIndex,
|
addedIndex,
|
||||||
|
@ -161,32 +177,39 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
determineColors(context, index, daysToSkip) {
|
DateBoxCurrentTheme determineCurrentDateBoxTheme(
|
||||||
Map<String, Color> calendarColors = {
|
BuildContext context,
|
||||||
'backgroundColor': Colors.transparent,
|
int index,
|
||||||
'textColor': Colors.black
|
int daysToSkip,
|
||||||
};
|
DateTimePickerTheme theme,
|
||||||
|
) {
|
||||||
|
DateBoxCurrentTheme determinedTheme = DateBoxCurrentTheme(
|
||||||
|
theme.baseTheme.backgroundColor ?? Colors.transparent,
|
||||||
|
theme.baseTheme.textStyle ?? const TextStyle(color: Colors.black),
|
||||||
|
);
|
||||||
|
|
||||||
if (isDisabled(index, daysToSkip)) {
|
if (isDisabled(index, daysToSkip)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).disabledColor,
|
theme.disabledTheme.backgroundColor ?? Theme.of(context).disabledColor,
|
||||||
'textColor': Colors.white
|
theme.disabledTheme.textStyle ?? const TextStyle(color: Colors.white),
|
||||||
};
|
);
|
||||||
}
|
}
|
||||||
if (isSelected(index, daysToSkip)) {
|
if (isSelected(index, daysToSkip)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).primaryColor.withOpacity(0.3),
|
theme.selectedTheme.backgroundColor ??
|
||||||
'textColor': Theme.of(context).primaryColor
|
Theme.of(context).primaryColor.withOpacity(0.3),
|
||||||
};
|
theme.selectedTheme.textStyle ??
|
||||||
|
TextStyle(color: Theme.of(context).primaryColor));
|
||||||
}
|
}
|
||||||
if (shouldHighlight(index, daysToSkip)) {
|
if (shouldHighlight(index, daysToSkip)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).primaryColor,
|
theme.highlightTheme.backgroundColor ??
|
||||||
'textColor': Colors.white
|
Theme.of(context).primaryColor,
|
||||||
};
|
theme.highlightTheme.textStyle ??
|
||||||
|
const TextStyle(color: Colors.white));
|
||||||
}
|
}
|
||||||
|
|
||||||
return calendarColors;
|
return determinedTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDisabled(int index, int daysToSkip) {
|
bool isDisabled(int index, int daysToSkip) {
|
||||||
|
@ -228,7 +251,7 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
|
|
||||||
BorderRadius _determineBorderRadius(
|
BorderRadius _determineBorderRadius(
|
||||||
DateTimePickerController dateTimePickerController) {
|
DateTimePickerController dateTimePickerController) {
|
||||||
switch (dateTimePickerController.dateBoxShape) {
|
switch (dateTimePickerController.theme.dateBoxShape) {
|
||||||
case DateBoxShape.circle:
|
case DateBoxShape.circle:
|
||||||
return BorderRadius.circular(monthDateBoxSize * 2);
|
return BorderRadius.circular(monthDateBoxSize * 2);
|
||||||
case DateBoxShape.rectangle:
|
case DateBoxShape.rectangle:
|
||||||
|
@ -239,39 +262,9 @@ class MonthDateTimePicker extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WrongTimeDialog extends StatelessWidget {
|
|
||||||
const WrongTimeDialog({required this.dateTimePickerController, Key? key})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
final DateTimePickerController dateTimePickerController;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('Verkeerde tijd gekozen'),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: ListBody(
|
|
||||||
children: const <Widget>[
|
|
||||||
Text(
|
|
||||||
'De tijd die u wilt kiezen, is niet mogelijk, maak een andere keuze.'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: const Text('OK'),
|
|
||||||
onPressed: () {
|
|
||||||
displayTimePicker(context, dateTimePickerController);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
displayTimePicker(BuildContext context,
|
displayTimePicker(BuildContext context,
|
||||||
DateTimePickerController dateTimePickerController) async {
|
DateTimePickerController dateTimePickerController) async {
|
||||||
await showTimePicker(
|
return await showTimePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialTime: TimeOfDay.now(),
|
initialTime: TimeOfDay.now(),
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class MonthDateTimePickerSheet extends StatelessWidget {
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: MediaQuery.of(context).size.height * 0.33,
|
height: MediaQuery.of(context).size.height * 0.33,
|
||||||
child: PageView(
|
child: PageView(
|
||||||
controller: dateTimePickerController.getPageController(),
|
controller: dateTimePickerController.pageController,
|
||||||
onPageChanged: (i) {
|
onPageChanged: (i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
dateTimePickerController.onPageChanged(
|
dateTimePickerController.onPageChanged(
|
||||||
|
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||||
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
import 'package:flutter_date_time_picker/src/extensions/date_time.dart';
|
||||||
import 'package:flutter_date_time_picker/src/extensions/time_of_day.dart';
|
import 'package:flutter_date_time_picker/src/extensions/time_of_day.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_box_current_theme.dart';
|
||||||
|
import 'package:flutter_date_time_picker/src/models/date_time_picker_theme.dart';
|
||||||
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
import 'package:flutter_date_time_picker/src/utils/date_time_picker_controller.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
@ -26,12 +28,10 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
date.daysOfWeek().length,
|
date.daysOfWeek().length,
|
||||||
(index) {
|
(index) {
|
||||||
late Map<String, Color> calendarColors;
|
late DateBoxCurrentTheme currentDateBoxTheme;
|
||||||
|
|
||||||
calendarColors = determineColors(
|
currentDateBoxTheme = determineCurrentDateBoxTheme(
|
||||||
context,
|
context, index, dateTimePickerController.theme);
|
||||||
index,
|
|
||||||
);
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: isDisabled(
|
onTap: isDisabled(
|
||||||
index,
|
index,
|
||||||
|
@ -50,18 +50,8 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
DateTime selectedDate = date.daysOfWeek()[index];
|
DateTime selectedDate = date.daysOfWeek()[index];
|
||||||
|
|
||||||
if (dateTimePickerController.pickTime) {
|
if (dateTimePickerController.pickTime) {
|
||||||
timeOfDay = await showTimePicker(
|
timeOfDay = await displayTimePicker(
|
||||||
context: context,
|
context, dateTimePickerController);
|
||||||
initialTime: TimeOfDay.now(),
|
|
||||||
builder: (BuildContext context, Widget? child) {
|
|
||||||
return MediaQuery(
|
|
||||||
data: MediaQuery.of(context).copyWith(
|
|
||||||
alwaysUse24HourFormat:
|
|
||||||
dateTimePickerController
|
|
||||||
.alwaysUse24HourFormat),
|
|
||||||
child: child!,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeOfDay != null &&
|
if (timeOfDay != null &&
|
||||||
|
@ -76,7 +66,7 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
child: ListBody(
|
child: ListBody(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'De tijd die u wilt kiezen, is niet mogelijk, makke een andere keuze.'),
|
'De tijd die u wilt kiezen, is niet mogelijk, maak een andere keuze.'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -84,14 +74,14 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
timeOfDay = TimeOfDay(
|
timeOfDay = const TimeOfDay(
|
||||||
hour: 0,
|
hour: 0,
|
||||||
minute: 0,
|
minute: 0,
|
||||||
);
|
);
|
||||||
|
@ -126,7 +116,7 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
height: weekDateBoxSize,
|
height: weekDateBoxSize,
|
||||||
width: weekDateBoxSize,
|
width: weekDateBoxSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: calendarColors['backgroundColor'],
|
color: currentDateBoxTheme.backgroundColor,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
_determineBorderRadius(dateTimePickerController),
|
_determineBorderRadius(dateTimePickerController),
|
||||||
),
|
),
|
||||||
|
@ -135,10 +125,7 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
date.daysOfWeek().elementAt(index).day.toString(),
|
date.daysOfWeek().elementAt(index).day.toString(),
|
||||||
style: Theme.of(context)
|
style: currentDateBoxTheme.textStyle,
|
||||||
.textTheme
|
|
||||||
.bodyMedium!
|
|
||||||
.copyWith(color: calendarColors['textColor']),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (shouldMark(index)) ...[
|
if (shouldMark(index)) ...[
|
||||||
|
@ -148,7 +135,9 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
width: weekDateBoxSize / 3,
|
width: weekDateBoxSize / 3,
|
||||||
height: weekDateBoxSize / 3,
|
height: weekDateBoxSize / 3,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).indicatorColor,
|
color: dateTimePickerController
|
||||||
|
.theme.markedIndicatorColor ??
|
||||||
|
Theme.of(context).indicatorColor,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(weekDateBoxSize * 2),
|
BorderRadius.circular(weekDateBoxSize * 2),
|
||||||
),
|
),
|
||||||
|
@ -168,32 +157,38 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
determineColors(context, index) {
|
DateBoxCurrentTheme determineCurrentDateBoxTheme(
|
||||||
Map<String, Color> calendarColors = {
|
BuildContext context,
|
||||||
'backgroundColor': Colors.transparent,
|
int index,
|
||||||
'textColor': Colors.black
|
DateTimePickerTheme theme,
|
||||||
};
|
) {
|
||||||
|
DateBoxCurrentTheme determinedTheme = DateBoxCurrentTheme(
|
||||||
|
theme.baseTheme.backgroundColor ?? Colors.transparent,
|
||||||
|
theme.baseTheme.textStyle ?? const TextStyle(color: Colors.black),
|
||||||
|
);
|
||||||
|
|
||||||
if (isDisabled(index)) {
|
if (isDisabled(index)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).disabledColor,
|
theme.disabledTheme.backgroundColor ?? Theme.of(context).disabledColor,
|
||||||
'textColor': Colors.white
|
theme.disabledTheme.textStyle ?? const TextStyle(color: Colors.white),
|
||||||
};
|
);
|
||||||
}
|
}
|
||||||
if (isSelected(index)) {
|
if (isSelected(index)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).primaryColor.withOpacity(0.3),
|
theme.selectedTheme.backgroundColor ??
|
||||||
'textColor': Theme.of(context).primaryColor
|
Theme.of(context).primaryColor.withOpacity(0.3),
|
||||||
};
|
theme.selectedTheme.textStyle ??
|
||||||
|
TextStyle(color: Theme.of(context).primaryColor));
|
||||||
}
|
}
|
||||||
if (shouldHighlight(index)) {
|
if (shouldHighlight(index)) {
|
||||||
calendarColors = {
|
determinedTheme = DateBoxCurrentTheme(
|
||||||
'backgroundColor': Theme.of(context).primaryColor,
|
theme.highlightTheme.backgroundColor ??
|
||||||
'textColor': Colors.white
|
Theme.of(context).primaryColor,
|
||||||
};
|
theme.highlightTheme.textStyle ??
|
||||||
|
const TextStyle(color: Colors.white));
|
||||||
}
|
}
|
||||||
|
|
||||||
return calendarColors;
|
return determinedTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldHighlight(int index) {
|
bool shouldHighlight(int index) {
|
||||||
|
@ -232,7 +227,7 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
|
|
||||||
BorderRadius _determineBorderRadius(
|
BorderRadius _determineBorderRadius(
|
||||||
DateTimePickerController dateTimePickerController) {
|
DateTimePickerController dateTimePickerController) {
|
||||||
switch (dateTimePickerController.dateBoxShape) {
|
switch (dateTimePickerController.theme.dateBoxShape) {
|
||||||
case DateBoxShape.circle:
|
case DateBoxShape.circle:
|
||||||
return BorderRadius.circular(weekDateBoxSize * 2);
|
return BorderRadius.circular(weekDateBoxSize * 2);
|
||||||
case DateBoxShape.rectangle:
|
case DateBoxShape.rectangle:
|
||||||
|
@ -241,4 +236,19 @@ class WeekDateTimePicker extends StatelessWidget {
|
||||||
return BorderRadius.circular(weekDateBoxSize / 4.5);
|
return BorderRadius.circular(weekDateBoxSize / 4.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayTimePicker(BuildContext context,
|
||||||
|
DateTimePickerController dateTimePickerController) async {
|
||||||
|
return await showTimePicker(
|
||||||
|
context: context,
|
||||||
|
initialTime: TimeOfDay.now(),
|
||||||
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
return MediaQuery(
|
||||||
|
data: MediaQuery.of(context).copyWith(
|
||||||
|
alwaysUse24HourFormat:
|
||||||
|
dateTimePickerController.alwaysUse24HourFormat),
|
||||||
|
child: child!,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class WeekDateTimePickerSheet extends StatelessWidget {
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: PageView(
|
child: PageView(
|
||||||
controller: dateTimePickerController.getPageController(),
|
controller: dateTimePickerController.pageController,
|
||||||
onPageChanged: (i) {
|
onPageChanged: (i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
dateTimePickerController.onPageChanged(
|
dateTimePickerController.onPageChanged(
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
import 'package:flutter_date_time_picker/flutter_date_time_picker.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('adds one to input values', () {
|
testWidgets('MyWidget has a title and message', (tester) async {
|
||||||
final calculator = Calculator();
|
// Create the widget by telling the tester to build it.
|
||||||
expect(calculator.addOne(2), 3);
|
await tester.pumpWidget(Scaffold(
|
||||||
expect(calculator.addOne(-7), -6);
|
appBar: AppBar(),
|
||||||
expect(calculator.addOne(0), 1);
|
body: DateTimePicker(
|
||||||
|
pickTime: false,
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|