@@ -34,89 +34,92 @@ class _Berichten extends State<Berichten> with AfterLayoutMixin<Berichten> {
3434 ),
3535 ],
3636 body: RefreshIndicator (
37- child: ValueListenableBuilder (
38- valueListenable: updateNotifier,
39- builder: (BuildContext context, box, Widget child) {
40- List <Widget > berichten = [];
41- String lastDay;
42- if (account.berichten.isEmpty) {
43- return EmptyPage (
44- text: "Geen berichten" ,
45- icon: Icons .email_outlined,
46- );
47- }
48- for (int i = 0 ; i < account.berichten.length; i++ ) {
49- ValueNotifier <Bericht > ber = ValueNotifier (account.berichten[i]);
50- if (lastDay != ber.value.dag) {
51- berichten.add (
52- ContentHeader (ber.value.dag),
37+ child: SingleChildScrollView (
38+ physics: AlwaysScrollableScrollPhysics (),
39+ child: ValueListenableBuilder (
40+ valueListenable: updateNotifier,
41+ builder: (BuildContext context, box, Widget child) {
42+ List <Widget > berichten = [];
43+ String lastDay;
44+ if (account.berichten.isEmpty) {
45+ return EmptyPage (
46+ text: "Geen berichten" ,
47+ icon: Icons .email_outlined,
5348 );
5449 }
55- berichten.add (
56- SeeCard (
57- border: account.berichten.length - 1 == i || account.berichten[i + 1 ].dag != ber.value.dag
58- ? null
59- : Border (
60- bottom: greyBorderSide (),
61- ),
62- child: Stack (
63- children: [
64- ValueListenableBuilder (
65- valueListenable: ber,
66- builder: (c, ber, _) {
67- if (ber.read)
68- return Container ();
69- else
70- return Padding (
71- child: Align (
72- alignment: Alignment .topRight,
73- child: Container (
74- width: 10 ,
75- height: 10 ,
76- decoration: BoxDecoration (
77- shape: BoxShape .circle,
78- color: userdata.get ("accentColor" ),
50+ for (int i = 0 ; i < account.berichten.length; i++ ) {
51+ ValueNotifier <Bericht > ber = ValueNotifier (account.berichten[i]);
52+ if (lastDay != ber.value.dag) {
53+ berichten.add (
54+ ContentHeader (ber.value.dag),
55+ );
56+ }
57+ berichten.add (
58+ SeeCard (
59+ border: account.berichten.length - 1 == i || account.berichten[i + 1 ].dag != ber.value.dag
60+ ? null
61+ : Border (
62+ bottom: greyBorderSide (),
63+ ),
64+ child: Stack (
65+ children: [
66+ ValueListenableBuilder (
67+ valueListenable: ber,
68+ builder: (c, ber, _) {
69+ if (ber.read)
70+ return Container ();
71+ else
72+ return Padding (
73+ child: Align (
74+ alignment: Alignment .topRight,
75+ child: Container (
76+ width: 10 ,
77+ height: 10 ,
78+ decoration: BoxDecoration (
79+ shape: BoxShape .circle,
80+ color: userdata.get ("accentColor" ),
81+ ),
7982 ),
8083 ),
81- ),
82- padding: EdgeInsets .all (
83- 10 ,
84+ padding: EdgeInsets .all (
85+ 10 ,
86+ ),
87+ );
88+ },
89+ ),
90+ ListTile (
91+ trailing: Padding (
92+ child: ber.value.prioriteit ? Icon (Icons .error, color: Colors .redAccent) : null ,
93+ padding: EdgeInsets .only (
94+ top: 7 ,
95+ left: 7 ,
96+ ),
97+ ),
98+ subtitle: Text (
99+ ber.value.afzender,
100+ ),
101+ title: Text (
102+ ber.value.onderwerp,
103+ overflow: TextOverflow .ellipsis,
104+ maxLines: 1 ,
105+ ),
106+ onTap: () {
107+ Navigator .of (context).push (
108+ MaterialPageRoute (
109+ builder: (context) => BerichtPagina (ber),
84110 ),
85111 );
86- },
87- ),
88- ListTile (
89- trailing: Padding (
90- child: ber.value.prioriteit ? Icon (Icons .error, color: Colors .redAccent) : null ,
91- padding: EdgeInsets .only (
92- top: 7 ,
93- left: 7 ,
94- ),
95- ),
96- subtitle: Text (
97- ber.value.afzender,
98- ),
99- title: Text (
100- ber.value.onderwerp,
101- overflow: TextOverflow .ellipsis,
102- maxLines: 1 ,
112+ },
103113 ),
104- onTap: () {
105- Navigator .of (context).push (
106- MaterialPageRoute (
107- builder: (context) => BerichtPagina (ber),
108- ),
109- );
110- },
111- ),
112- ],
114+ ],
115+ ),
113116 ),
114- ),
115- ) ;
116- lastDay = ber.value.dag;
117- }
118- return buildLiveList (berichten, 10 );
119- } ,
117+ );
118+ lastDay = ber.value.dag ;
119+ }
120+ return buildLiveList (berichten, 10 );
121+ },
122+ ) ,
120123 ),
121124 onRefresh: () async {
122125 await handleError (account.magister.berichten.refresh, "Kon berichten niet verversen" , context);
@@ -176,30 +179,17 @@ class BerichtPagina extends StatelessWidget {
176179 onError: (error, retry) {
177180 if (! (error is DioError )) throw (error);
178181 },
179- errorBuilder: (context, error, retry) {
180- if (! (error is DioError ))
181- return Text ("Dit zou je nooit moeten zien, error: \n\n $error " );
182- else
183- return RefreshIndicator (
184- onRefresh: () async => retry (),
185- child: SingleChildScrollView (
186- physics: AlwaysScrollableScrollPhysics (),
187- child: Center (
188- child: Container (
189- width: MediaQuery .of (context).size.width - 50 ,
190- height: bodyHeight (context),
191- child: Text (
192- "Kon geen verbinding maken met Magister:\n ${(error as dynamic ).error .toString ()}" ,
193- style: TextStyle (
194- color: Colors .grey,
195- fontSize: 20 ,
196- ),
197- textAlign: TextAlign .center,
198- ),
199- ),
200- ),
182+ errorBuilder: (context, dynamic error, retry) {
183+ return RefreshIndicator (
184+ onRefresh: () async => retry (),
185+ child: SingleChildScrollView (
186+ physics: AlwaysScrollableScrollPhysics (),
187+ child: EmptyPage (
188+ icon: Icons .wifi_off_outlined,
189+ text: error? .error ?? error? .toString () ?? error.message ?? error,
201190 ),
202- );
191+ ),
192+ );
203193 },
204194 dataBuilder: (context, data) {
205195 Bericht ber = data[0 ];
0 commit comments