mini_calendar 3.0.3 mini_calendar: ^3.0.3 copied to clipboard
Date component developed with Flutter, plans to support display, swipe left and right, add date mark, radio, display week, etc.
import 'package:example/calendar_customize.dart';
import 'package:example/calendar_view.dart';
import 'package:example/month_page_view_demo.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildButton('年历', CalendarViewPage()),
_buildButton('翻页日历', MonthPageViewDemo()),
_buildButton('自定义', CalendarCustomizePage())
],
),
),
);
}
Widget _buildButton(String label, Widget page) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (ctx) => page)),
child: Text(label),
),
);
}
}