panic_widgets 1.0.2 panic_widgets: ^1.0.2 copied to clipboard
A collection of widgets that are useful in pretty much any app.
Panic widgets #
A collection of widgets that are useful in pretty much any app.
Calendar #
A better material design calender widget that can adapt to pretty much any resolution.
Example/Suggested usage:
PanicCalendar(
daysOfWeek: {
for (int i = 0; i < 5; i++) i + 1: DayOfWeekOptions(name: weekNames[i]),
DateTime.saturday: DayOfWeekOptions(name: weekNames[5], nameTextColor: Colors.grey, textColor: Colors.grey),
DateTime.sunday: DayOfWeekOptions(name: weekNames[6], nameTextColor: Colors.red[900], textColor: Colors.red),
},
monthNames: {
for (int i = 1; i <= 12; i++) i: monthNames[i],
},
dateOptions: {
for (int y in _holidays.keys)
for (int m in _holidays[y].keys)
for (DateTime date in _holidays[y][m].keys)
date: DateOptions(
color: _holidays[y][m][date].color,
),
},
events: _events,
daySelected: (day) {
//TODO: handle day selection
},
monthSwitched: (year, month) {
//TODO: fetch data for selected month (e.g. holidays)
},
tileEventBuilder: (context, day, events) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
for (Event e in events ?? [])
Container(
width: 4,
height: 4,
decoration: BoxDecoration(
color: e.color,
shape: BoxShape.circle,
),
),
],
);
},
);
Centered scroll card #
A material card that is centered to the screen and handles scrolling correctly. Useful for login screens or similar.
Example/Suggested usage:
PanicCenteredScrollCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
//TODO: Your card's content.
],
),
);
Drawer #
A better, more programmer friendly material drawer.
Example/Suggested usage:
PanicDrawer(
currentAccountPicture: CircleAvatar(
child: Text('ME'),
),
accountName: Text('Mr. Example / exampleman'),
accountEmail: Text('man@example.com'),
headerImage: AssetImage('assets/logo.png'),
items: [
for (RouteItem item in routeItems)
ListTile(
leading: item.icon,
title: Text(item.title),
onTap: () => goTo(context, item.route),
),
],
detailItems: [
ListTile(
leading: Icon(
Icons.settings,
color: Theme.of(context).primaryIconTheme.color,
),
title: Text(
'Settings',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
onTap: () => goTo(context, '/settings'),
),
ListTile(
leading: Icon(
Icons.exit_to_app,
color: Theme.of(context).primaryIconTheme.color,
),
title: Text(
'Log out',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
onTap: logOut,
),
],
);