Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 29 additions & 34 deletions lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,28 @@ final List<RouteBase> routes = [
),
routes: [
GoRoute(
path: 'sales/order/:pk/pay',
name: 'sales-order-pay',
pageBuilder: (context, state) {
return CustomTransitionPage(
barrierColor: Colors.black54,
opaque: false,
transitionDuration: const Duration(milliseconds: 150),
transitionsBuilder: (
context,
animation,
secondaryAnimation,
child,
) {
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
),
child: child,
);
},
child: SalesOrderDialog(pk: state.params['pk']!),
);
},
),
path: 'sales/order/:pk/pay',
name: 'sales-order-pay',
pageBuilder: (context, state) => CustomTransitionPage(
barrierColor: Colors.black54,
opaque: false,
transitionDuration: const Duration(milliseconds: 150),
transitionsBuilder: (
context,
animation,
secondaryAnimation,
child,
) {
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
),
child: child,
);
},
child: SalesOrderDialog(pk: state.params['pk']!),
)),
]),
GoRoute(
path: '/events',
Expand Down Expand Up @@ -373,15 +370,13 @@ final List<RouteBase> routes = [
GoRoute(
path: '/pizzas',
name: 'food',
pageBuilder: (context, state) {
return MaterialPage(
key: state.pageKey,
child: FoodScreen(
pk: (state.extra as Event?)?.foodEvent,
event: state.extra as Event?,
),
);
},
pageBuilder: (context, state) => MaterialPage(
key: state.pageKey,
child: FoodScreen(
pk: (state.extra as Event?)?.foodEvent,
event: state.extra as Event?,
),
),
routes: [
GoRoute(
path: 'admin',
Expand Down
2 changes: 1 addition & 1 deletion lib/tosti/tosti_shift_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class TostiShiftScreen extends StatelessWidget {

return RefreshIndicator(
onRefresh: () => cubit.load(id),
child: CustomScrollView(
child: SafeCustomScrollView(
slivers: [header, orderList],
),
);
Expand Down
27 changes: 12 additions & 15 deletions lib/ui/screens/albums_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,31 +194,28 @@ class AlbumListScrollView extends StatelessWidget {
Widget build(BuildContext context) {
return Scrollbar(
controller: controller,
child: CustomScrollView(
child: SafeCustomScrollView(
controller: controller,
physics: const RangeMaintainingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
slivers: [
SliverPadding(
padding: const EdgeInsets.all(8),
sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
delegate: SliverChildBuilderDelegate(
(context, index) => AlbumTile(
album: listState.results[index],
),
childCount: listState.results.length,
SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
delegate: SliverChildBuilderDelegate(
(context, index) => AlbumTile(
album: listState.results[index],
),
childCount: listState.results.length,
),
),
if (listState.isLoadingMore)
const SliverPadding(
padding: EdgeInsets.all(8),
padding: EdgeInsets.only(top: 8),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed([
Center(
Expand Down
78 changes: 38 additions & 40 deletions lib/ui/screens/calendar_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,54 +234,52 @@ class CalendarScrollView extends StatelessWidget {

return Scrollbar(
controller: controller,
child: CustomScrollView(
child: SafeCustomScrollView(
controller: controller,
physics: const RangeMaintainingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
padding: const EdgeInsets.all(8),
slivers: [
SliverPadding(
padding: const EdgeInsets.all(12),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
final month = months[index];
final events = monthGroupedEvents[month]!;

final dayGroupedEvents = _groupByDay(events);
final days = dayGroupedEvents.keys.toList();

return StickyHeader(
header: SizedBox(
width: double.infinity,
child: Material(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(
month.year == DateTime.now().year
? monthFormatter
.format(month.toLocal())
.toUpperCase()
: monthYearFormatter
.format(month.toLocal())
.toUpperCase(),
style: Theme.of(context).textTheme.titleMedium,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
final month = months[index];
final events = monthGroupedEvents[month]!;

final dayGroupedEvents = _groupByDay(events);
final days = dayGroupedEvents.keys.toList();

return StickyHeader(
header: SizedBox(
width: double.infinity,
child: Material(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Text(
month.year == DateTime.now().year
? monthFormatter
.format(month.toLocal())
.toUpperCase()
: monthYearFormatter
.format(month.toLocal())
.toUpperCase(),
style: Theme.of(context).textTheme.titleMedium,
),
),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
for (final day in days)
_DayCard(day: day, events: dayGroupedEvents[day]!),
],
),
);
},
childCount: monthGroupedEvents.length,
),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
for (final day in days)
_DayCard(day: day, events: dayGroupedEvents[day]!),
],
),
);
},
childCount: monthGroupedEvents.length,
),
),
if (calendarState.isLoadingMore)
Expand Down
26 changes: 12 additions & 14 deletions lib/ui/screens/event_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -898,24 +898,22 @@ class _EventScreenState extends State<EventScreen> {
actions: [_makeShareEventButton(widget.pk)],
),
body: RefreshIndicator(
onRefresh: () async {
// Await only the event info.
_registrationsCubit.load();
await _eventCubit.load();
},
child: ErrorScrollView(state.message!),
),
onRefresh: () async {
// Await only the event info.
_registrationsCubit.load();
await _eventCubit.load();
},
child: ErrorScrollView(state.message!)),
);
} else if (state is LoadingState &&
state is! ResultState &&
widget.event == null) {
return Scaffold(
appBar: ThaliaAppBar(
title: const Text('EVENT'),
actions: [_makeShareEventButton(widget.pk)],
),
body: const Center(child: CircularProgressIndicator()),
);
appBar: ThaliaAppBar(
title: const Text('EVENT'),
actions: [_makeShareEventButton(widget.pk)],
),
body: const Center(child: CircularProgressIndicator()));
} else {
final event = (state.result ?? widget.event)!;
return Scaffold(
Expand Down Expand Up @@ -946,7 +944,7 @@ class _EventScreenState extends State<EventScreen> {
builder: (context, listState) {
return Scrollbar(
controller: _controller,
child: CustomScrollView(
child: SafeCustomScrollView(
controller: _controller,
key: const PageStorageKey('event'),
slivers: [
Expand Down
1 change: 1 addition & 0 deletions lib/ui/screens/food_admin_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class _FoodAdminScreenState extends State<FoodAdminScreen> {
}
}

//TODO: This does not carry any state?
class _OrderTile extends StatefulWidget {
final AdminFoodOrder order;

Expand Down
4 changes: 2 additions & 2 deletions lib/ui/screens/group_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class _Page extends StatelessWidget {
body: RefreshIndicator(
onRefresh: () => cubit.load(),
child: Scrollbar(
child: CustomScrollView(
child: SafeCustomScrollView(
key: const PageStorageKey('group'),
slivers: [
SliverToBoxAdapter(
Expand All @@ -125,7 +125,7 @@ class _Page extends StatelessWidget {
body: RefreshIndicator(
onRefresh: () => cubit.load(),
child: Scrollbar(
child: CustomScrollView(
child: SafeCustomScrollView(
key: const PageStorageKey('group'),
slivers: [
SliverToBoxAdapter(
Expand Down
25 changes: 11 additions & 14 deletions lib/ui/screens/groups_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,33 +158,30 @@ class GroupListScrollView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scrollbar(
child: CustomScrollView(
child: SafeCustomScrollView(
physics: const RangeMaintainingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
slivers: [
if (activeBoard != null)
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(8),
padding: const EdgeInsets.only(bottom: 8),
child: AspectRatio(
aspectRatio: 3 / 2,
child: GroupTile(group: activeBoard!),
),
),
),
SliverPadding(
padding: const EdgeInsets.all(8),
sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
delegate: SliverChildBuilderDelegate(
(context, index) => GroupTile(group: groups[index]),
childCount: groups.length,
),
SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
delegate: SliverChildBuilderDelegate(
(context, index) => GroupTile(group: groups[index]),
childCount: groups.length,
),
),
],
Expand Down
Loading