Skip to content

Commit b341936

Browse files
committed
Fixed status bar color (removed useless safe areas)
1 parent b028f5c commit b341936

3 files changed

Lines changed: 98 additions & 117 deletions

File tree

lib/views/CategoryViewPage.dart

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -318,15 +318,13 @@ class _CategoryViewPageState extends State<CategoryViewPage> with SingleTickerPr
318318
child: Scaffold(
319319
resizeToAvoidBottomInset: true,
320320
extendBody: true,
321-
body: SafeArea(
322-
child: RefreshIndicator(
323-
onRefresh: _onRefresh,
324-
child: CustomScrollView(
325-
slivers: [
326-
_createAppBar,
327-
SliverToBoxAdapter(child: _createFutureBuilders,),
328-
],
329-
),
321+
body: RefreshIndicator(
322+
onRefresh: _onRefresh,
323+
child: CustomScrollView(
324+
slivers: [
325+
_createAppBar,
326+
SliverToBoxAdapter(child: _createFutureBuilders,),
327+
],
330328
),
331329
),
332330
floatingActionButton: _isEditMode
@@ -396,18 +394,12 @@ class _CategoryViewPageState extends State<CategoryViewPage> with SingleTickerPr
396394
handleImagesSnapshot(imagesSnapshot);
397395
}
398396
return _createPageContent(albums, nbImages);
399-
} else {
400-
return Center(
401-
child: CircularProgressIndicator(),
402-
);
403397
}
398+
return Center(child: CircularProgressIndicator());
404399
},
405400
);
406-
} else {
407-
return Center(
408-
child: CircularProgressIndicator(),
409-
);
410401
}
402+
return Center(child: CircularProgressIndicator());
411403
}
412404
);
413405
}

lib/views/ImageViewPage.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import 'package:cached_network_image/cached_network_image.dart';
22
import 'package:flutter/material.dart';
33
import 'package:icon_shadow/icon_shadow.dart';
4-
import 'package:open_file/open_file.dart';
5-
import 'package:path_provider/path_provider.dart';
64
import 'package:photo_view/photo_view.dart';
75
import 'package:piwigo_ng/api/API.dart';
86
import 'package:piwigo_ng/api/ImageAPI.dart';
@@ -31,6 +29,7 @@ class _ImageViewPageState extends State<ImageViewPage> with SingleTickerProvider
3129
AnimationController _animationController;
3230
Animation<Color> _backgroundAnimation;
3331
Animation<double> _heightAnimation;
32+
3433
String _derivative;
3534
PageController _pageController;
3635
ScrollPhysics _pageViewPhysic = BouncingScrollPhysics();
@@ -231,7 +230,7 @@ class _ImageViewPageState extends State<ImageViewPage> with SingleTickerProvider
231230
appBar: PreferredSize(
232231
preferredSize: Size.fromHeight(kToolbarHeight * _heightAnimation.value),
233232
child: Transform.translate(
234-
offset: Offset(0, -kToolbarHeight*(1-_heightAnimation.value)),
233+
offset: Offset(0, -kToolbarHeight * (1-_heightAnimation.value)),
235234
child: AppBar(
236235
iconTheme: IconThemeData(
237236
color: Theme.of(context).iconTheme.color, //change your color here
@@ -248,7 +247,6 @@ class _ImageViewPageState extends State<ImageViewPage> with SingleTickerProvider
248247
},
249248
icon: Icon(Icons.chevron_left),
250249
),
251-
toolbarHeight: kToolbarHeight*_heightAnimation.value,
252250
actions: MediaQuery.of(context).orientation == Orientation.landscape ? [
253251
IconButton(
254252
onPressed: _onEditImage,

lib/views/RootCategoryViewPage.dart

Lines changed: 87 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class RootCategoryViewPage extends StatefulWidget {
2828
class _RootCategoryViewPageState extends State<RootCategoryViewPage> with SingleTickerProviderStateMixin {
2929
String _rootCategory;
3030
TextEditingController _searchController = TextEditingController();
31-
ScrollController _scrollController = ScrollController();
3231
bool _isSearching = false;
3332
final FocusNode _focus = FocusNode();
3433

@@ -79,119 +78,111 @@ class _RootCategoryViewPageState extends State<RootCategoryViewPage> with Single
7978
ThemeData _theme = Theme.of(context);
8079
return Scaffold(
8180
key: RootCategoryViewPage.rootKey,
82-
body: SafeArea(
83-
child: GestureDetector(
84-
onTap: () {
85-
_focus.unfocus();
81+
body: GestureDetector(
82+
onTap: () {
83+
_focus.unfocus();
84+
},
85+
child: RefreshIndicator(
86+
onRefresh: () {
87+
setState(() {
88+
_getData();
89+
});
90+
return Future.delayed(Duration(milliseconds: 1000));
8691
},
87-
child: RefreshIndicator(
88-
onRefresh: () {
89-
setState(() {
90-
_getData();
91-
});
92-
return Future.delayed(Duration(milliseconds: 1000));
93-
},
94-
child: CustomScrollView(
95-
slivers: [
96-
SliverAppBar(
97-
pinned: true,
98-
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
99-
leading: IconButton(
100-
onPressed: () {
101-
Navigator.of(context).push(
102-
MaterialPageRoute(builder: (context) => SettingsPage()),
103-
);
104-
},
105-
icon: Icon(Icons.settings, color: _theme.iconTheme.color),
106-
),
107-
title: Text(appStrings(context).tabBar_albums,
108-
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
109-
),
110-
),
111-
AppBarSearch(
112-
textController: _searchController,
113-
onTap: () {},
114-
focusNode: _focus,
115-
onSubmit: (string) {
116-
setState(() {
117-
_isSearching = _searchController.text.length > 0;
118-
_getData();
119-
});
92+
child: CustomScrollView(
93+
slivers: [
94+
SliverAppBar(
95+
pinned: true,
96+
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
97+
leading: IconButton(
98+
onPressed: () {
99+
Navigator.of(context).push(
100+
MaterialPageRoute(builder: (context) => SettingsPage()),
101+
);
120102
},
103+
icon: Icon(Icons.settings, color: _theme.iconTheme.color),
121104
),
122-
SliverToBoxAdapter(
123-
child: Builder(builder: (context) {
124-
if(_isSearching) {
125-
return FutureBuilder<Map<String,dynamic>>(
126-
key: UniqueKey(),
127-
future: _imagesFuture,
128-
builder: (BuildContext context, AsyncSnapshot imagesSnapshot) {
129-
if(imagesSnapshot.hasData){
130-
if(imagesSnapshot.data['stat'] == 'fail') {
131-
return Center(
132-
child: Text(appStrings(context).categoryImageList_noDataError),
133-
);
134-
}
135-
var images = imagesSnapshot.data['result']['images'];
136-
var nbImages = images.length;
137-
return Column(
138-
children: [
139-
_imageGrid(images),
140-
Center(
141-
child: Container(
142-
padding: EdgeInsets.all(10),
143-
child: Text(appStrings(context).imageCount(nbImages), style: TextStyle(fontSize: 20, color: _theme.textTheme.bodyText2.color, fontWeight: FontWeight.w300,),),
144-
),
145-
),
146-
],
147-
);
148-
} else {
149-
return Center(
150-
child: CircularProgressIndicator(),
151-
);
152-
}
153-
},
154-
);
155-
}
105+
title: Text(appStrings(context).tabBar_albums,
106+
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
107+
),
108+
),
109+
AppBarSearch(
110+
textController: _searchController,
111+
onTap: () {},
112+
focusNode: _focus,
113+
onSubmit: (string) {
114+
setState(() {
115+
_isSearching = _searchController.text.length > 0;
116+
_getData();
117+
});
118+
},
119+
),
120+
SliverToBoxAdapter(
121+
child: Builder(builder: (context) {
122+
if(_isSearching) {
156123
return FutureBuilder<Map<String,dynamic>>(
157124
key: UniqueKey(),
158-
future: _albumsFuture, // Albums of the list
159-
builder: (BuildContext context, AsyncSnapshot albumSnapshot) {
160-
if(albumSnapshot.hasData){
161-
if(albumSnapshot.data['stat'] == 'fail') {
162-
return Container(
163-
padding: EdgeInsets.all(10),
164-
child: Text(albumSnapshot.data['result']),
165-
); //appStrings(context).categoryMainEmpty
125+
future: _imagesFuture,
126+
builder: (BuildContext context, AsyncSnapshot imagesSnapshot) {
127+
if(imagesSnapshot.hasData){
128+
if(imagesSnapshot.data['stat'] == 'fail') {
129+
return Center(
130+
child: Text(appStrings(context).categoryImageList_noDataError),
131+
);
166132
}
167-
var albums = albumSnapshot.data['result']['categories'];
168-
int nbPhotos = 0;
169-
albums.forEach((cat) => nbPhotos+=cat["total_nb_images"]);
170-
albums.removeWhere((category) => (
171-
category["id"].toString() == _rootCategory
172-
));
133+
var images = imagesSnapshot.data['result']['images'];
134+
var nbImages = images.length;
173135
return Column(
174136
children: [
175-
_albumGrid(albums),
137+
_imageGrid(images),
176138
Center(
177139
child: Container(
178140
padding: EdgeInsets.all(10),
179-
child: Text(appStrings(context).imageCount(nbPhotos), style: TextStyle(fontSize: 20, color: _theme.textTheme.bodyText2.color, fontWeight: FontWeight.w300,),),
141+
child: Text(appStrings(context).imageCount(nbImages), style: TextStyle(fontSize: 20, color: _theme.textTheme.bodyText2.color, fontWeight: FontWeight.w300,),),
180142
),
181143
),
182144
],
183145
);
184-
} else {
185-
return Center(
186-
child: CircularProgressIndicator(),
187-
);
188146
}
147+
return Center(child: CircularProgressIndicator());
189148
},
190149
);
191-
}),
192-
),
193-
],
194-
),
150+
}
151+
return FutureBuilder<Map<String,dynamic>>(
152+
key: UniqueKey(),
153+
future: _albumsFuture, // Albums of the list
154+
builder: (BuildContext context, AsyncSnapshot albumSnapshot) {
155+
if(albumSnapshot.hasData){
156+
if(albumSnapshot.data['stat'] == 'fail') {
157+
return Container(
158+
padding: EdgeInsets.all(10),
159+
child: Text(albumSnapshot.data['result']),
160+
); //appStrings(context).categoryMainEmpty
161+
}
162+
var albums = albumSnapshot.data['result']['categories'];
163+
int nbPhotos = 0;
164+
albums.forEach((cat) => nbPhotos+=cat["total_nb_images"]);
165+
albums.removeWhere((category) => (
166+
category["id"].toString() == _rootCategory
167+
));
168+
return Column(
169+
children: [
170+
_albumGrid(albums),
171+
Center(
172+
child: Container(
173+
padding: EdgeInsets.all(10),
174+
child: Text(appStrings(context).imageCount(nbPhotos), style: TextStyle(fontSize: 20, color: _theme.textTheme.bodyText2.color, fontWeight: FontWeight.w300,),),
175+
),
176+
),
177+
],
178+
);
179+
}
180+
return Center(child: CircularProgressIndicator());
181+
},
182+
);
183+
}),
184+
),
185+
],
195186
),
196187
),
197188
),

0 commit comments

Comments
 (0)