Skip to content

Commit d425d99

Browse files
committed
Material menus
1 parent 5ef2bc2 commit d425d99

File tree

12 files changed

+785
-724
lines changed

12 files changed

+785
-724
lines changed

lib/interface/components/material/application.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ class _BaseAppState extends State<BaseApp> {
296296
return NavigationRailDestination(
297297
icon: x.icon,
298298
selectedIcon: x.selectedIcon,
299-
label: Text(x.label),
299+
label: Text(x.label,
300+
style: TextStyle(color: Theme.of(context).colorScheme.onSurface, fontSize: 13)),
300301
);
301302
}).toList()),
302303
MediaQuery.of(context).size.width >= 640),

lib/interface/components/material/data_page.dart

Lines changed: 83 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables
2-
32
import 'package:darq/darq.dart';
43
import 'package:dynamic_color/dynamic_color.dart';
54
import 'package:enum_flag/enum_flag.dart';
@@ -112,79 +111,79 @@ class DataPageState extends State<DataPage> with TickerProviderStateMixin {
112111
pinned: true,
113112
snap: false,
114113
floating: false,
115-
flexibleSpace: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
116-
var top = constraints.biggest.height;
117-
var padding = 100.0 - ((constraints.maxHeight - 64) * 100 / (242 - 64));
118-
119-
return FlexibleSpaceBar(
120-
centerTitle: false,
121-
titlePadding: EdgeInsets.only(left: (isChildPage ?? false) ? padding : 20, bottom: 15, right: 20),
122-
title: AnimatedOpacity(
123-
duration: Duration(milliseconds: 250),
124-
opacity: (top > 110 || widget.leading == null) ? 1.0 : 0.0,
125-
child: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis)),
126-
background: Stack(children: <Widget>[
127-
// Search icon
128-
if (widget.pageFlags.hasFlag(DataPageType.searchable))
129-
SearchAnchor(
130-
isFullScreen: true,
131-
builder: (context, controller) => Padding(
132-
padding: (isChildPage ?? false) && widget.trailing != null
133-
? const EdgeInsets.only(left: 65, top: 17)
134-
: const EdgeInsets.all(15.0),
135-
child: Align(
136-
alignment:
137-
(isChildPage ?? false) && widget.trailing == null ? Alignment.topRight : Alignment.topLeft,
138-
child: SafeArea(
139-
child: Icon(
140-
Icons.search,
141-
size: 25,
142-
color: Theme.of(context).colorScheme.onSurface,
143-
))),
114+
flexibleSpace: LayoutBuilder(
115+
builder: (BuildContext context, BoxConstraints constraints) => FlexibleSpaceBar(
116+
centerTitle: false,
117+
titlePadding: EdgeInsets.only(
118+
left: (isChildPage ?? false) ? (100.0 - ((constraints.maxHeight - 64) * 100 / (242 - 64))) : 20,
119+
bottom: 15,
120+
right: 20),
121+
title: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis),
122+
background: Stack(children: <Widget>[
123+
// Search icon
124+
if (widget.pageFlags.hasFlag(DataPageType.searchable))
125+
SearchAnchor(
126+
isFullScreen: true,
127+
builder: (context, controller) => Padding(
128+
padding: (isChildPage ?? false) && widget.trailing != null
129+
? const EdgeInsets.only(left: 65, top: 17)
130+
: const EdgeInsets.all(15.0),
131+
child: Align(
132+
alignment: (isChildPage ?? false) && widget.trailing == null
133+
? Alignment.topRight
134+
: Alignment.topLeft,
135+
child: SafeArea(
136+
child: Icon(
137+
Icons.search,
138+
size: 25,
139+
color: Theme.of(context).colorScheme.onSurface,
140+
))),
141+
),
142+
suggestionsBuilder: widget.searchBuilder ??
143+
(context, controller) => (widget.children ?? []).prepend(SizedBox(height: 15)),
144+
),
145+
// Refresh progress status
146+
if ((Share.session.refreshStatus.progressStatus?.isNotEmpty ?? false) &&
147+
widget.pageFlags.hasFlag(DataPageType.refreshable))
148+
SafeArea(
149+
child: Padding(
150+
padding: switch (isChildPage ?? false) {
151+
false when widget.pageFlags.hasFlag(DataPageType.searchable) =>
152+
const EdgeInsets.only(left: 45), // Search icon only
153+
false when !widget.pageFlags.hasFlag(DataPageType.searchable) =>
154+
const EdgeInsets.only(left: 5), // Nothing in the way
155+
true when widget.pageFlags.hasFlag(DataPageType.searchable) && widget.trailing == null =>
156+
const EdgeInsets.only(left: 45), // Back icon only
157+
true when widget.pageFlags.hasFlag(DataPageType.searchable) && widget.trailing != null =>
158+
const EdgeInsets.only(left: 100), // Two icons ::before
159+
_ => const EdgeInsets.all(0),
160+
},
161+
child: Container(
162+
margin: const EdgeInsets.only(top: 10, left: 10),
163+
child: ConstrainedBox(
164+
constraints: const BoxConstraints(maxWidth: 150),
165+
child: Row(children: [
166+
Flexible(
167+
child: Text(
168+
Share.session.refreshStatus.progressStatus ?? '',
169+
maxLines: 2,
170+
overflow: TextOverflow.ellipsis,
171+
style: const TextStyle(
172+
color: CupertinoColors.inactiveGray, fontSize: 13, fontWeight: FontWeight.w300),
173+
))
174+
]))),
175+
),
144176
),
145-
suggestionsBuilder: widget.searchBuilder ??
146-
(context, controller) => (widget.children ?? []).prepend(SizedBox(height: 15)),
147-
),
148-
// Refresh progress status
149-
if ((Share.session.refreshStatus.progressStatus?.isNotEmpty ?? false) &&
150-
widget.pageFlags.hasFlag(DataPageType.refreshable))
151-
SafeArea(
152-
child: Padding(
153-
padding: switch (isChildPage ?? false) {
154-
false when widget.pageFlags.hasFlag(DataPageType.searchable) =>
155-
const EdgeInsets.only(left: 45), // Search icon only
156-
false when !widget.pageFlags.hasFlag(DataPageType.searchable) =>
157-
const EdgeInsets.only(left: 5), // Nothing in the way
158-
true when widget.pageFlags.hasFlag(DataPageType.searchable) && widget.trailing == null =>
159-
const EdgeInsets.only(left: 45), // Back icon only
160-
true when widget.pageFlags.hasFlag(DataPageType.searchable) && widget.trailing != null =>
161-
const EdgeInsets.only(left: 100), // Two icons ::before
162-
_ => const EdgeInsets.all(0),
163-
},
164-
child: Container(
165-
margin: const EdgeInsets.only(top: 10, left: 10),
166-
child: ConstrainedBox(
167-
constraints: const BoxConstraints(maxWidth: 150),
168-
child: Text(
169-
Share.session.refreshStatus.progressStatus ?? '',
170-
maxLines: 2,
171-
overflow: TextOverflow.ellipsis,
172-
style: const TextStyle(
173-
color: CupertinoColors.inactiveGray, fontSize: 13, fontWeight: FontWeight.w300),
174-
))),
177+
if (widget.leading != null &&
178+
(!widget.pageFlags.hasFlag(DataPageType.refreshable) ||
179+
(Share.session.refreshStatus.progressStatus?.isEmpty ?? true)))
180+
SafeArea(
181+
child: SizedBox(
182+
height: 60,
183+
width: 150,
184+
child: Container(margin: EdgeInsets.only(left: 10, top: 3, bottom: 1), child: widget.leading)),
175185
),
176-
),
177-
if (widget.leading != null &&
178-
(!widget.pageFlags.hasFlag(DataPageType.refreshable) ||
179-
(Share.session.refreshStatus.progressStatus?.isEmpty ?? true)))
180-
SafeArea(
181-
child: SizedBox(
182-
height: 60,
183-
width: 150,
184-
child: Container(margin: EdgeInsets.only(left: 10, top: 3, bottom: 1), child: widget.leading)),
185-
),
186-
]));
187-
}),
186+
]))),
188187
leadingWidth: widget.leading != null ? 150 : null,
189188
leading: widget.leading != null ? Container() : null,
190189
actions: <Widget>[Container(margin: EdgeInsets.only(right: 10), child: widget.trailing)],
@@ -217,9 +216,21 @@ class DataPageState extends State<DataPage> with TickerProviderStateMixin {
217216
SliverFillRemaining(
218217
child: TabBarView(
219218
controller: tabController,
219+
viewportFraction: MediaQuery.of(context).size.width >= 640 ? (1 / 3) : 1.0,
220220
children: List.generate(widget.segments!.length,
221221
(index) => widget.pageBuilder!(context, widget.segments!.keys.elementAt(index))),
222222
),
223+
// hasScrollBody: false,
224+
// child: Column(
225+
// children: [
226+
// AutoScaleTabBarView(
227+
// controller: tabController,
228+
// // viewportFraction: MediaQuery.of(context).size.width >= 640 ? (1 / 3) : 1.0,
229+
// children: List.generate(widget.segments!.length,
230+
// (index) => widget.pageBuilder!(context, widget.segments!.keys.elementAt(index))),
231+
// ),
232+
// ],
233+
// ),
223234
),
224235
],
225236
);

lib/interface/components/material/elements/attendance.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ extension LessonWidgetExtension on Attendance {
7474
context: context,
7575
builder: (context) => MessageComposePage(
7676
receivers: [teacher],
77-
subject: '89BEEDA5-3774-4BC0-B827-72D3AA2E31CC'.localized.format(DateFormat("y.M.d").format(date), lessonNo),
77+
subject: '89BEEDA5-3774-4BC0-B827-72D3AA2E31CC'
78+
.localized
79+
.format(DateFormat("y.M.d").format(date), lessonNo),
7880
signature:
7981
'${Share.session.data.student.account.name}, ${Share.session.data.student.mainClass.name}'));
8082
}),
@@ -88,10 +90,12 @@ extension LessonWidgetExtension on Attendance {
8890
builder: (context) => MessageComposePage(
8991
receivers: [Share.session.data.student.mainClass.classTutor],
9092
subject: 'CC111EE5-B18F-46EB-A6FF-09E3ABFA1FA1'.localized,
91-
message:
92-
'853265A9-1B40-43F2-82B5-E9E238EF8A5B'.localized.format(DateFormat("y.M.dd").format(date), lessonNo),
93-
signature:
94-
'F491D698-DFB6-4E62-B100-1546660AB6D1'.localized.format(Share.session.data.student.account.name, Share.session.data.student.mainClass.name)));
93+
message: '853265A9-1B40-43F2-82B5-E9E238EF8A5B'
94+
.localized
95+
.format(DateFormat("y.M.dd").format(date), lessonNo),
96+
signature: 'F491D698-DFB6-4E62-B100-1546660AB6D1'.localized.format(
97+
Share.session.data.student.account.name, Share.session.data.student.mainClass.name)));
98+
Navigator.of(context).pop();
9599
}),
96100
type == AttendanceType.absent),
97101
longPressOnly: true,

0 commit comments

Comments
 (0)