mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-11 18:39:45 +00:00
feat: console_page - cleaned up dead code and unused l10n strings
This commit is contained in:
parent
85bc997776
commit
f7f791cc0c
|
@ -46,12 +46,10 @@
|
||||||
},
|
},
|
||||||
"console_page": {
|
"console_page": {
|
||||||
"title": "Console",
|
"title": "Console",
|
||||||
"waiting": "Waiting for initialization…",
|
|
||||||
"copy": "Copy",
|
"copy": "Copy",
|
||||||
"copy_raw": "Raw response",
|
"copy_raw": "Raw response",
|
||||||
"history_empty": "No data yet",
|
"history_empty": "No data yet",
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"log": "Log",
|
|
||||||
"rest_api_request": "Rest API Request",
|
"rest_api_request": "Rest API Request",
|
||||||
"rest_api_response": "Rest API Response",
|
"rest_api_response": "Rest API Response",
|
||||||
"graphql_request": "GraphQL Request",
|
"graphql_request": "GraphQL Request",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:auto_route/auto_route.dart';
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
|
||||||
import 'package:selfprivacy/config/get_it_config.dart';
|
import 'package:selfprivacy/config/get_it_config.dart';
|
||||||
import 'package:selfprivacy/logic/models/console_log.dart';
|
import 'package:selfprivacy/logic/models/console_log.dart';
|
||||||
import 'package:selfprivacy/ui/pages/more/console/console_log_item_widget.dart';
|
import 'package:selfprivacy/ui/pages/more/console/console_log_item_widget.dart';
|
||||||
|
@ -18,21 +17,15 @@ class ConsolePage extends StatefulWidget {
|
||||||
class _ConsolePageState extends State<ConsolePage> {
|
class _ConsolePageState extends State<ConsolePage> {
|
||||||
ConsoleModel get console => getIt<ConsoleModel>();
|
ConsoleModel get console => getIt<ConsoleModel>();
|
||||||
|
|
||||||
/// should freeze logs state to properly read logs
|
|
||||||
late final Future<void> future;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
future = getIt.allReady();
|
|
||||||
console.addListener(update);
|
console.addListener(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
console.removeListener(update);
|
console.removeListener(update);
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +41,10 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => SafeArea(
|
Widget build(final BuildContext context) {
|
||||||
|
final List<ConsoleLog> logs = console.logs;
|
||||||
|
|
||||||
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('console_page.title'.tr()),
|
title: Text('console_page.title'.tr()),
|
||||||
|
@ -68,46 +64,13 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Scrollbar(
|
body: Scrollbar(
|
||||||
child: FutureBuilder(
|
child: logs.isEmpty
|
||||||
future: future,
|
|
||||||
builder: (
|
|
||||||
final BuildContext context,
|
|
||||||
final AsyncSnapshot<void> snapshot,
|
|
||||||
) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
final List<ConsoleLog> logs = console.logs;
|
|
||||||
|
|
||||||
return logs.isEmpty
|
|
||||||
? const _ConsoleViewEmpty()
|
? const _ConsoleViewEmpty()
|
||||||
: _ConsoleViewLoaded(logs: logs);
|
: _ConsoleViewLoaded(logs: logs),
|
||||||
}
|
|
||||||
|
|
||||||
return const _ConsoleViewLoading();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ConsoleViewLoading extends StatelessWidget {
|
|
||||||
const _ConsoleViewLoading();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(final BuildContext context) => Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
Text('console_page.waiting'.tr()),
|
|
||||||
const Gap(16),
|
|
||||||
const Expanded(
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator.adaptive(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ConsoleViewEmpty extends StatelessWidget {
|
class _ConsoleViewEmpty extends StatelessWidget {
|
||||||
|
|
Loading…
Reference in a new issue