Skip to content

Commit

Permalink
fixed navigation bar colors
Browse files Browse the repository at this point in the history
  • Loading branch information
clragon committed Jun 23, 2020
1 parent b1ebde9 commit 2eab4f3
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 91 deletions.
2 changes: 1 addition & 1 deletion lib/appinfo.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const String appName = 'e1547';
const String appVersion = '1.4.0';
const String appVersion = '1.4.1';
const String defaultEndpoint = 'e926.net';
const String about = 'An app for e621 and e926.';
const String developer = 'binaryfloof';
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ValueNotifier<ThemeData> _theme = ValueNotifier(themeMap['dark']);

void main() async {
WidgetsFlutterBinding.ensureInitialized();
WidgetsBinding.instance.renderView.automaticSystemUiAdjustment = false;
_theme.value = themeMap[await db.theme.value];
db.theme.addListener(() async => _theme.value = themeMap[await db.theme.value]);
runApp(Main());
Expand Down
182 changes: 93 additions & 89 deletions lib/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,10 @@ class PostWidget extends StatefulWidget {
}

class _PostWidgetState extends State<PostWidget> {

bool isVisible() {
return (widget.post.isFavorite.value || widget.post.ignoreSafety.value || !widget.post.isBlacklisted);
return (widget.post.isFavorite.value ||
widget.post.ignoreSafety.value ||
!widget.post.isBlacklisted);
}

@override
Expand Down Expand Up @@ -326,7 +327,10 @@ class _PostWidgetState extends State<PostWidget> {
2), // maybe set this to around 50% of screen DPS
)),
() {
if ((widget.post.file['url'] == null && !widget.post.isDeleted) || !isVisible() || widget.post.ignoreSafety.value) {
if ((widget.post.file['url'] == null &&
!widget.post.isDeleted) ||
!isVisible() ||
widget.post.ignoreSafety.value) {
return Positioned(
child: FlatButton(
color: value ? Colors.black12 : null,
Expand All @@ -347,12 +351,15 @@ class _PostWidgetState extends State<PostWidget> {
onPressed: () async {
widget.post.ignoreSafety.value =
!widget.post.ignoreSafety.value;
Post urls = await client.post(widget.post.id, unsafe: true);
Post urls = await client.post(widget.post.id,
unsafe: true);
setState(() {
if (widget.post.file['url'] == null) {
widget.post.file['url'] = urls.file['url'];
widget.post.sample['url'] = urls.sample['url'];
widget.post.preview['url'] = urls.preview['url'];
widget.post.sample['url'] =
urls.sample['url'];
widget.post.preview['url'] =
urls.preview['url'];
} else if (!widget.post.isBlacklisted) {
widget.post.file['url'] = null;
widget.post.sample['url'] = null;
Expand All @@ -376,79 +383,7 @@ class _PostWidgetState extends State<PostWidget> {
return Stack(
children: <Widget>[
Center(child: imageWidget()),
new AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: IconShadowWidget(
Icon(
Icons.arrow_back,
color: Theme.of(context).iconTheme.color,
),
shadowColor: Colors.black,
),
onPressed: () => Navigator.of(context).pop(),
),
actions: <Widget>[
PopupMenuButton<String>(
icon: IconShadowWidget(
Icon(
Icons.more_vert,
color: Theme.of(context).iconTheme.color,
),
shadowColor: Colors.black,
),
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem(
value: 'share',
child: Padding(
padding: EdgeInsets.all(4),
child: Text('Share'),
),
),
widget.post.file['url'] != null && (Platform.isAndroid)
? PopupMenuItem(
value: 'download',
child: Padding(
padding: EdgeInsets.all(4),
child: Text(
'Download',
maxLines: 1,
),
),
)
: null,
PopupMenuItem(
//
value: 'browser',
child: Padding(
padding: EdgeInsets.all(4),
child: Text(
'Browse',
maxLines: 1,
),
),
)
],
onSelected: (value) async {
switch (value) {
case 'share':
Share.share(
widget.post.url(await db.host.value).toString());
break;
case 'download':
downloadDialog(context, widget.post);
break;
case 'browser':
url.launch(
widget.post.url(await db.host.value).toString());
break;
}
},
),
],
)
postAppBar(context, widget.post),
// appbarOverlay(),
],
);
Expand All @@ -459,19 +394,18 @@ class _PostWidgetState extends State<PostWidget> {
builder: (context, value, child) {
return new GestureDetector(
onTap: () {
if (widget.post.file['ext'] != 'webm' && widget.post.file['url'] != null && isVisible()) {
List<Post> posts = widget.posts ?? [widget.post];
return _onTapImage(
context, posts, posts.indexOf(widget.post));
if (widget.post.file['ext'] != 'webm' &&
widget.post.file['url'] != null &&
isVisible()) {
List<Post> posts = widget.posts ?? [widget.post];
return _onTapImage(context, posts, posts.indexOf(widget.post));
} else {
return () {};
}
}(),
child: overlayImageWidget(),
);
},


);
}

Expand Down Expand Up @@ -1191,19 +1125,89 @@ class _PostWidgetState extends State<PostWidget> {
widget.post.file['ext'] == 'swf') {
url.launch(widget.post.file['url']);
} else {
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]);
setUIColors(Theme.of(context));
SystemChrome.setEnabledSystemUIOverlays([]);
await Navigator.of(context).push(new MaterialPageRoute<Null>(
builder: fullScreenWidgetBuilder,
));
setUIColors(Theme.of(context));
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
setUIColors(Theme.of(context));
}
};
}
}

Widget postAppBar(BuildContext context, Post post) {
return AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: IconShadowWidget(
Icon(
Icons.arrow_back,
color: Theme.of(context).iconTheme.color,
),
shadowColor: Colors.black,
),
onPressed: () => Navigator.of(context).pop(),
),
actions: <Widget>[
PopupMenuButton<String>(
icon: IconShadowWidget(
Icon(
Icons.more_vert,
color: Theme.of(context).iconTheme.color,
),
shadowColor: Colors.black,
),
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
PopupMenuItem(
value: 'share',
child: Padding(
padding: EdgeInsets.all(4),
child: Text('Share'),
),
),
post.file['url'] != null && (Platform.isAndroid)
? PopupMenuItem(
value: 'download',
child: Padding(
padding: EdgeInsets.all(4),
child: Text(
'Download',
maxLines: 1,
),
),
)
: null,
PopupMenuItem(
//
value: 'browser',
child: Padding(
padding: EdgeInsets.all(4),
child: Text(
'Browse',
maxLines: 1,
),
),
)
],
onSelected: (value) async {
switch (value) {
case 'share':
Share.share(post.url(await db.host.value).toString());
break;
case 'download':
downloadDialog(context, post);
break;
case 'browser':
url.launch(post.url(await db.host.value).toString());
break;
}
},
),
],
);
}

Future<File> download(Post post) async {
String downloadFolder =
'${Platform.environment['EXTERNAL_STORAGE']}/Pictures/$appName';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: e1547
description: A mobile app for e621+e926.

version: 1.4.0+25
version: 1.4.1+26

environment:
sdk: ">=2.2.2 <3.0.0"
Expand Down

0 comments on commit 2eab4f3

Please sign in to comment.