Skip to content
Snippets Groups Projects
Commit 163b072a authored by Leon Tappe's avatar Leon Tappe :fire:
Browse files

make copying details possible

parent 99b2bb3b
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import '/environment_config.dart';
import '/models/admin_form_data.dart';
import '/util.dart';
import '/widgets/cool_card.dart';
import '/widgets/info_tile.dart';
import '/widgets/password_dialog.dart';
class AdminDetailsPage extends StatefulWidget {
......@@ -67,10 +68,9 @@ class _AdminDetailsPageState extends State<AdminDetailsPage> {
const Icon(Icons.check, color: darkGreen),
],
children: [
ListTile(
InfoTile(
title: Text('ID'),
trailing:
Text(_admin.id.toString(), style: Theme.of(context).textTheme.subtitle1),
data: _admin.id.toString(),
),
Divider(),
ListTile(
......
import 'dart:async';
import 'package:asta_theme/asta_theme.dart';
import 'package:astaprint_admin/widgets/info_tile.dart';
import 'package:blocs_astaprint/auth.dart';
import 'package:blocs_astaprint/print_queue.dart';
import 'package:blocs_astaprint/printers.dart';
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:http/http.dart' as http;
......@@ -71,12 +73,7 @@ class _PrinterDetailsPageState extends State<PrinterDetailsPage> {
const Icon(Icons.check, color: darkGreen),
],
children: [
ListTile(
title: Text('ID'),
trailing: Text(
widget.printer.id.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(title: Text('ID'), data: widget.printer.id.toString()),
Divider(),
ListTile(
title: Text('Stellplatznummer'),
......@@ -214,38 +211,28 @@ class _PrinterDetailsPageState extends State<PrinterDetailsPage> {
title: Text('Zählerstände',
style: Theme.of(context).textTheme.headline6),
contentPadding: EdgeInsets.all(0.0)),
ListTile(
title: Text('Gesamt'),
trailing: Text(
_printer.counter.total.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Schwarz-Weiß'),
trailing: Text(
_printer.counter.printBw.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Farbe'),
trailing: Text(
(_printer.counter.printTotal - _printer.counter.printBw)
.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Schwarz-Weiß-Kopien'),
trailing: Text(
_printer.counter.copyBw.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Farbkopien'),
trailing: Text(
(_printer.counter.copyTotal - _printer.counter.copyBw)
.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('Gesamt'),
data: _printer.counter.total.toString(),
),
InfoTile(
title: Text('Schwarz-Weiß'),
data: _printer.counter.printBw.toString(),
),
InfoTile(
title: Text('Farbe'),
data: (_printer.counter.printTotal - _printer.counter.printBw)
.toString(),
),
InfoTile(
title: Text('Schwarz-Weiß-Kopien'),
data: _printer.counter.copyBw.toString(),
),
InfoTile(
title: Text('Farbkopien'),
data: (_printer.counter.copyTotal - _printer.counter.copyBw)
.toString(),
),
],
),
if (_printer.status != null)
......@@ -256,44 +243,34 @@ class _PrinterDetailsPageState extends State<PrinterDetailsPage> {
title:
Text('Status', style: Theme.of(context).textTheme.headline6),
contentPadding: EdgeInsets.all(0.0)),
ListTile(
title: Text('Scanner'),
trailing: Text(
_printer.status.scan == 0
? 'Aktiv'
: _printer.status.scanStatus.join(', '),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Drucker'),
trailing: Text(
_printer.status.copy == 0
? 'Aktiv'
: _printer.status.copyStatus.join(', '),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('Scanner'),
data: _printer.status.scan == 0
? 'Aktiv'
: _printer.status.scanStatus.join(', '),
),
InfoTile(
title: Text('Drucker'),
data: _printer.status.copy == 0
? 'Aktiv'
: _printer.status.copyStatus.join(', '),
),
ListTile(
title:
Text('Papier', style: Theme.of(context).textTheme.headline6),
contentPadding: EdgeInsets.all(0.0)),
ListTile(
title: Text('Papierfach 1'),
trailing: Text(
(_printer.status.tray1 ?? 0).toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Papierfach 2'),
trailing: Text(
(_printer.status.tray2 ?? 0).toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Papierfach 3'),
trailing: Text(
(_printer.status.tray3 ?? 0).toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('Papierfach 1'),
data: (_printer.status.tray1 ?? 0).toString(),
),
InfoTile(
title: Text('Papierfach 2'),
data: (_printer.status.tray2 ?? 0).toString(),
),
InfoTile(
title: Text('Papierfach 3'),
data: (_printer.status.tray3 ?? 0).toString(),
),
ListTile(
title:
Text('Toner', style: Theme.of(context).textTheme.headline6),
......
......@@ -9,6 +9,7 @@ import '/models/user_form_data.dart';
import '/pages/user_details/journal_card.dart';
import '/util.dart';
import '/widgets/cool_card.dart';
import '/widgets/info_tile.dart';
import '/widgets/password_dialog.dart';
class UserDetailsPage extends StatefulWidget {
......@@ -62,32 +63,24 @@ class _UserDetailsPageState extends State<UserDetailsPage> {
const Icon(Icons.check, color: darkGreen),
],
children: [
ListTile(
title: Text('Erstellt'),
trailing: Text(
dateTimeFormat.format(_user.created),
style: Theme.of(context).textTheme.subtitle1,
)),
ListTile(
title: Text('Geändert'),
trailing: Text(
dateTimeFormat.format(_user.updated),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('Erstellt'),
data: dateTimeFormat.format(_user.created),
),
InfoTile(
title: Text('Geändert'),
data: dateTimeFormat.format(_user.updated),
),
if (_user.card != null)
ListTile(
title: Text('SN'),
trailing: Text(
_user.card.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('SN'),
data: _user.card.toString(),
),
if (_user.pin != null)
ListTile(
title: Text('PIN'),
trailing: Text(
_user.pin.toString(),
style: Theme.of(context).textTheme.subtitle1,
)),
InfoTile(
title: Text('PIN'),
data: _user.pin.toString(),
),
Divider(),
ListTile(
title: Text('Nutzername'),
......
import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart';
class InfoTile extends StatelessWidget {
final EdgeInsets contentPadding;
final Text title;
final String data;
final Widget subtitle;
const InfoTile(
{Key key, this.contentPadding, @required this.title, @required this.data, this.subtitle})
: super(key: key);
@override
Widget build(BuildContext context) {
return ListTile(
title: title,
subtitle: subtitle,
onTap: () => _onCopyData(context),
trailing: Text(
data,
style: Theme.of(context).textTheme.subtitle1,
),
contentPadding: contentPadding,
);
}
void _onCopyData(BuildContext context) async {
await FlutterClipboard.copy(data);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Wert für ${(title as Text).data} in die Zwischenablage kopiert')));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment