new change to use intaleq_map sdk 04-16-4
This commit is contained in:
169
packages/calendar_builder/example/lib/custom_month_builder.dart
Normal file
169
packages/calendar_builder/example/lib/custom_month_builder.dart
Normal file
@@ -0,0 +1,169 @@
|
||||
import 'package:calendar_builder/calendar_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMonthBuilderScreen extends StatelessWidget {
|
||||
const CustomMonthBuilderScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CbMonthBuilder(
|
||||
cbConfig: CbConfig(
|
||||
startDate: DateTime(2020),
|
||||
endDate: DateTime(2123),
|
||||
selectedDate: DateTime(2022),
|
||||
selectedYear: DateTime(2022),
|
||||
weekStartsFrom: WeekStartsFrom.sunday,
|
||||
eventDates: [
|
||||
DateTime(2022, 1, 2),
|
||||
DateTime(2022, 1, 2),
|
||||
DateTime(2022, 1, 3)
|
||||
],
|
||||
highlightedDates: [
|
||||
DateTime(2022, 1, 6),
|
||||
DateTime(2022, 1, 3)
|
||||
]),
|
||||
yearDropDownCustomizer: YearDropDownCustomizer(
|
||||
yearHeaderBuilder:
|
||||
(isYearPickerExpanded, selectedDate, selectedYear, year) {
|
||||
return Container(
|
||||
height: 40,
|
||||
color: Colors.yellow,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
year,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Icon(!isYearPickerExpanded
|
||||
? Icons.arrow_drop_down_outlined
|
||||
: Icons.arrow_drop_up_outlined)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
monthCustomizer: MonthCustomizer(
|
||||
montMinhHeight: 200,
|
||||
monthMinWidth: 450,
|
||||
padding: const EdgeInsets.all(20),
|
||||
monthHeaderBuilder:
|
||||
(month, headerHeight, headerWidth, paddingLeft) {
|
||||
return Container(
|
||||
color: Colors.grey[200],
|
||||
height: headerHeight,
|
||||
width: headerWidth,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: paddingLeft),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
month,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
monthWeekBuilder: (index, weeks, weekHeight, weekWidth) {
|
||||
return SizedBox(
|
||||
height: weekHeight,
|
||||
width: weekWidth,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: Colors.red)),
|
||||
child: Align(
|
||||
child: Text(
|
||||
weeks,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
monthButtonBuilder: (dateTime,
|
||||
childHeight,
|
||||
childWidth,
|
||||
isSelected,
|
||||
isDisabled,
|
||||
hasEvent,
|
||||
isHighlighted,
|
||||
isCurrentDay) {
|
||||
//Text Theme
|
||||
final txtTheme = Theme.of(context).textTheme;
|
||||
//color theme
|
||||
final colorTheme = Theme.of(context);
|
||||
|
||||
var daysText = Align(
|
||||
child: Text(
|
||||
'${dateTime.day}',
|
||||
style: isDisabled
|
||||
? txtTheme.titleMedium
|
||||
: isSelected
|
||||
? txtTheme.bodyLarge!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color:
|
||||
colorTheme.brightness == Brightness.dark
|
||||
? Colors.black
|
||||
: Colors.white)
|
||||
: isHighlighted
|
||||
? txtTheme.bodyLarge //Highlighted TextStyle
|
||||
: isCurrentDay
|
||||
? txtTheme
|
||||
.bodyLarge //CurrentDay TextStyle
|
||||
: txtTheme.bodyLarge,
|
||||
),
|
||||
);
|
||||
if (isSelected) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
margin: const EdgeInsets.all(2),
|
||||
child: daysText,
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: isDisabled ? Colors.grey[200] : Colors.yellow,
|
||||
shape: BoxShape.rectangle,
|
||||
border: hasEvent || isHighlighted
|
||||
? Border.all(
|
||||
color:
|
||||
isHighlighted ? Colors.red : Colors.blue,
|
||||
width: 2)
|
||||
: null),
|
||||
margin: const EdgeInsets.all(2),
|
||||
child: daysText,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import 'package:calendar_builder/calendar_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomizedMonthBuilderScreen extends StatefulWidget {
|
||||
const CustomizedMonthBuilderScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CustomizedMonthBuilderScreen> createState() =>
|
||||
_CustomizedMonthBuilderScreenState();
|
||||
}
|
||||
|
||||
class _CustomizedMonthBuilderScreenState
|
||||
extends State<CustomizedMonthBuilderScreen> {
|
||||
bool isDarkMode = true;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Theme(
|
||||
data: isDarkMode ? ThemeData.dark() : ThemeData.light(),
|
||||
child: Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CbMonthBuilder(
|
||||
cbConfig: CbConfig(
|
||||
startDate: DateTime(2020),
|
||||
endDate: DateTime(2123),
|
||||
selectedDate: DateTime(2022, 3, 4),
|
||||
selectedYear: DateTime(2022),
|
||||
weekStartsFrom: WeekStartsFrom.wednesday,
|
||||
disabledDates: [
|
||||
DateTime(2022, 1, 7),
|
||||
DateTime(2022, 1, 9),
|
||||
],
|
||||
eventDates: [
|
||||
DateTime(2022, 1, 2),
|
||||
DateTime(2022, 1, 2),
|
||||
DateTime(2022, 1, 3)
|
||||
],
|
||||
highlightedDates: [
|
||||
DateTime(2022, 1, 6),
|
||||
DateTime(2022, 1, 3)
|
||||
]),
|
||||
monthCustomizer: MonthCustomizer(
|
||||
padding: const EdgeInsets.all(20),
|
||||
monthHeaderCustomizer: MonthHeaderCustomizer(
|
||||
textStyle: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
monthButtonCustomizer: MonthButtonCustomizer(
|
||||
currentDayColor: Colors.orange,
|
||||
borderStrokeWidth: 2,
|
||||
textStyleOnDisabled:
|
||||
const TextStyle(color: Colors.red),
|
||||
highlightedColor:
|
||||
const Color.fromARGB(255, 255, 174, 0)),
|
||||
monthWeekCustomizer: MonthWeekCustomizer(
|
||||
textStyle: const TextStyle(
|
||||
color: Color.fromARGB(255, 255, 174, 0)))
|
||||
// monthWidth: 500,
|
||||
// monthHeight: 200
|
||||
),
|
||||
yearDropDownCustomizer: YearDropDownCustomizer(
|
||||
yearButtonCustomizer: YearButtonCustomizer(
|
||||
borderColorOnSelected: Colors.red,
|
||||
),
|
||||
yearHeaderCustomizer: YearHeaderCustomizer(
|
||||
titleTextStyle: const TextStyle(
|
||||
color: Color.fromARGB(255, 255, 174, 0)))),
|
||||
onYearHeaderExpanded: (isExpanded) {
|
||||
snackBar('isExpanded ' + isExpanded.toString());
|
||||
},
|
||||
onDateClicked: (onDateClicked) {
|
||||
snackBar('selected date' +
|
||||
onDateClicked.selectedDate.toString() +
|
||||
'\n' +
|
||||
'isSelected ' +
|
||||
onDateClicked.isSelected.toString() +
|
||||
'\n' +
|
||||
'isHighlighted ' +
|
||||
onDateClicked.isHighlighted.toString() +
|
||||
'\n' +
|
||||
'hasEvent ' +
|
||||
onDateClicked.hasEvent.toString() +
|
||||
'\n' +
|
||||
'isCurrentDate ' +
|
||||
onDateClicked.isCurrentDate.toString() +
|
||||
'\n' +
|
||||
'isDisabled ' +
|
||||
onDateClicked.isDisabled.toString());
|
||||
},
|
||||
onYearButtonClicked: (year, isSelected) {
|
||||
snackBar('selected year ' +
|
||||
year.toString() +
|
||||
'\n' +
|
||||
'isSelected ' +
|
||||
isSelected.toString());
|
||||
}),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
isDarkMode = !isDarkMode;
|
||||
setState(() {});
|
||||
},
|
||||
isExtended: true,
|
||||
label: Row(
|
||||
children: [
|
||||
Icon(!isDarkMode ? Icons.dark_mode : Icons.light_mode),
|
||||
Text(!isDarkMode ? ' Dark Mode' : ' Light Mode')
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void snackBar(Object meg) {
|
||||
ScaffoldMessenger.of(context)
|
||||
..hideCurrentSnackBar()
|
||||
..showSnackBar(SnackBar(content: Text(meg.toString())));
|
||||
}
|
||||
}
|
||||
88
packages/calendar_builder/example/lib/main.dart
Normal file
88
packages/calendar_builder/example/lib/main.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
import 'package:calendar_builder/calendar_builder.dart';
|
||||
import 'package:example/custom_month_builder.dart';
|
||||
import 'package:example/customized_month_builder.dart';
|
||||
import 'package:example/month_builder.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
CalendarGlobals.showLogs = true;
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Calendar builder Demo',
|
||||
// theme: ThemeData(brightness: Brightness.dark),
|
||||
// themeMode: ThemeMode.dark,
|
||||
// darkTheme: ThemeData.dark(),
|
||||
routes: {
|
||||
'/month_builder': (context) => const MonthBuilderScreen(),
|
||||
'/customized_month_builder': (context) =>
|
||||
const CustomizedMonthBuilderScreen(),
|
||||
'/custom_month_builder': (context) => const CustomMonthBuilderScreen(),
|
||||
// '/fromAsset': (context) => const PlayVideoFromAsset(),
|
||||
// '/fromNetwork': (context) => const PlayVideoFromNetwork(),
|
||||
// '/customVideo': (context) => const CustomVideoControlls(),
|
||||
},
|
||||
home: const MainPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MainPage extends StatefulWidget {
|
||||
const MainPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
// _button('Play video from File'),
|
||||
_button(
|
||||
'Default / Simple Month Builder',
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed('/month_builder'),
|
||||
),
|
||||
_button(
|
||||
'Customized Month Builder',
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed('/customized_month_builder'),
|
||||
),
|
||||
_button(
|
||||
'Custom Month Builder',
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pushNamed('/custom_month_builder'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _button(String text, {void Function()? onPressed}) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: OutlinedButton(
|
||||
onPressed: onPressed ?? () {},
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
28
packages/calendar_builder/example/lib/month_builder.dart
Normal file
28
packages/calendar_builder/example/lib/month_builder.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:calendar_builder/calendar_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MonthBuilderScreen extends StatelessWidget {
|
||||
const MonthBuilderScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: CbMonthBuilder(
|
||||
cbConfig: CbConfig(
|
||||
startDate: DateTime(2020),
|
||||
endDate: DateTime(2026),
|
||||
selectedDate: DateTime(2021, 3, 4),
|
||||
selectedYear: DateTime(2021),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user