Skip to content

Commit

Permalink
Improve contrast and hide leading when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernthedev committed Apr 3, 2024
1 parent 4bdd45b commit 5bbc699
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 46 deletions.
13 changes: 9 additions & 4 deletions lib/pages/main/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class _DeviceBrowserPageState extends State<DeviceBrowserPage> {
),
);

var conditionalExitButton =
Routemaster.of(context).history.canGoBack ? exitButton : null;

return Focus(
autofocus: true,
canRequestFocus: false,
Expand All @@ -122,7 +125,7 @@ class _DeviceBrowserPageState extends State<DeviceBrowserPage> {
length: 2,
child: Scaffold(
appBar: AppBar(
elevation: 0.8,
elevation: 2.8,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: _AppBarActions(
Expand All @@ -131,7 +134,8 @@ class _DeviceBrowserPageState extends State<DeviceBrowserPage> {
serial: widget.serial,
onUpload: _uploadFiles,
),
leading: exitButton,
leading: conditionalExitButton,
automaticallyImplyLeading: true,
actions: [listViewButton],
),
body: _buildBody(context),
Expand Down Expand Up @@ -226,8 +230,9 @@ class _DeviceBrowserPageState extends State<DeviceBrowserPage> {
files: list,
key: ValueKey(list),
filterController: _filterController,
builder: (context, filteredFiles) =>
_viewAsListMode ? _viewAsList(filteredFiles) : _viewAsGrid(filteredFiles),
builder: (context, filteredFiles) => _viewAsListMode
? _viewAsList(filteredFiles)
: _viewAsGrid(filteredFiles),
);
}

Expand Down
92 changes: 50 additions & 42 deletions lib/pages/main/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,47 @@ class _LogPageState extends State<LogPage> {
@override
void initState() {
super.initState();
_logFuture.then((values) {
final (process, stream) = values;
try {
_streamSubscription = stream.listen((event) {
setState(() {
var newLogs = event
.split(PlatformUtils.platformFileEnding)
.where((element) => element.trim().isNotEmpty);
_logs.addAll(newLogs);

if (waitForSave) {
var timeSinceSend = DateTime.now().difference(lastStreamSend);
if (timeSinceSend.inMilliseconds > 30) {
_saveLog();
waitForSave = false;
}
}

lastStreamSend = DateTime.now();
});
});
_streamSubscription?.onError((e) {
Trace.verbose(e);
_showError(e);
});
_streamSubscription?.onDone(() {
Trace.verbose("Done");
});
} catch (e) {
Trace.verbose(e.toString());
_showError(e.toString());
}
}).onError((error, stackTrace) {
_logFuture.then(_handleLogFuture).onError((error, stackTrace) {
Trace.verbose("Error $error");
Trace.verbose(stackTrace.toString());
_showError(error.toString());
});
}

FutureOr<Null> _handleLogFuture(values) {
final (process, stream) = values;
try {
_streamSubscription = stream.listen((event) {
setState(() {
var newLogs = event
.split(PlatformUtils.platformFileEnding)
.where((element) => element.trim().isNotEmpty);
_logs.addAll(newLogs);

if (waitForSave) {
var timeSinceSend = DateTime.now().difference(lastStreamSend);
if (timeSinceSend.inMilliseconds > 30) {
_saveLog();
waitForSave = false;
}
}

lastStreamSend = DateTime.now();
});
});
_streamSubscription?.onError((e) {
Trace.verbose(e);
_showError(e);
});
_streamSubscription?.onDone(() {
Trace.verbose("Done");
});
} catch (e) {
Trace.verbose(e.toString());
_showError(e.toString());
}
}

@override
void dispose() {
super.dispose();
Expand All @@ -90,18 +92,24 @@ class _LogPageState extends State<LogPage> {

@override
Widget build(BuildContext context) {
var exitButton = IconButton(
icon: const Icon(
FluentIcons.arrow_left_24_filled,
size: 24,
),
onPressed: () {
Routemaster.of(context).history.back();
},
);


var conditionalExitButton = Routemaster.of(context).history.canGoBack ? exitButton : null;

return Scaffold(
appBar: AppBar(
title: const Text("Logcat"),
leading: IconButton(
icon: const Icon(
FluentIcons.arrow_left_24_filled,
size: 24,
),
onPressed: () {
Routemaster.of(context).history.back();
},
),
leading: conditionalExitButton,
automaticallyImplyLeading: true,
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
Expand Down

0 comments on commit 5bbc699

Please sign in to comment.