merged to origin/devlop
This commit is contained in:
@ -5,8 +5,7 @@ class About extends StatelessWidget {
|
||||
const About({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Über diese App'),
|
||||
),
|
||||
@ -16,5 +15,4 @@ class About extends StatelessWidget {
|
||||
child: Text('Marianum Fulda'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ class _AnimatedTimeState extends State<AnimatedTime> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
Widget build(BuildContext context) => Row(
|
||||
children: [
|
||||
const Text('Noch '),
|
||||
buildWidget(current.inDays),
|
||||
@ -42,10 +41,8 @@ class _AnimatedTimeState extends State<AnimatedTime> {
|
||||
buildWidget(current.inSeconds > 60 ? current.inSeconds - current.inMinutes * 60 : current.inSeconds),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
AnimatedDigitWidget buildWidget(int value) {
|
||||
return AnimatedDigitWidget(
|
||||
AnimatedDigitWidget buildWidget(int value) => AnimatedDigitWidget(
|
||||
value: value,
|
||||
duration: const Duration(milliseconds: 100),
|
||||
textStyle: TextStyle(
|
||||
@ -53,7 +50,6 @@ class _AnimatedTimeState extends State<AnimatedTime> {
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
@ -5,11 +5,9 @@ class CenteredLeading extends StatelessWidget {
|
||||
const CenteredLeading(this.child, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
Widget build(BuildContext context) => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [child],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,7 @@ class ClickableAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const ClickableAppBar({required this.onTap, required this.appBar, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(onTap: onTap, child: appBar);
|
||||
}
|
||||
Widget build(BuildContext context) => GestureDetector(onTap: onTap, child: appBar);
|
||||
|
||||
@override
|
||||
Size get preferredSize => appBar.preferredSize;
|
||||
|
@ -15,8 +15,7 @@ class ConfirmDialog extends StatelessWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
Widget build(BuildContext context) => AlertDialog(
|
||||
icon: icon != null ? Icon(icon) : null,
|
||||
title: Text(title),
|
||||
content: Text(content),
|
||||
@ -30,7 +29,6 @@ class ConfirmDialog extends StatelessWidget {
|
||||
}, child: Text(confirmButton)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
static void openBrowser(BuildContext context, String url) {
|
||||
showDialog(
|
||||
|
@ -39,8 +39,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Lokaler cache'),
|
||||
),
|
||||
@ -52,7 +51,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
itemCount: snapshot.data!.length,
|
||||
itemBuilder: (context, index) {
|
||||
Map<String, dynamic> element = snapshot.data![snapshot.data!.keys.elementAt(index)];
|
||||
String filename = snapshot.data!.keys.elementAt(index).split('/').last;
|
||||
var filename = snapshot.data!.keys.elementAt(index).split('/').last;
|
||||
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.text_snippet_outlined),
|
||||
@ -60,13 +59,10 @@ class _CacheViewState extends State<CacheView> {
|
||||
subtitle: Text("${filesize(jsonEncode(element).length * 8)}, ${Jiffy.parseFromMillisecondsSinceEpoch(element['lastupdate']).fromNow()}"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||
return JsonViewer(title: filename, data: jsonDecode(element['json']));
|
||||
},));
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => JsonViewer(title: filename, data: jsonDecode(element['json'])),));
|
||||
},
|
||||
onLongPress: () {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return SimpleDialog(
|
||||
showDialog(context: context, builder: (context) => SimpleDialog(
|
||||
children: [
|
||||
const ListTile(
|
||||
leading: Icon(Icons.delete_forever),
|
||||
@ -81,8 +77,7 @@ class _CacheViewState extends State<CacheView> {
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
));
|
||||
},
|
||||
);
|
||||
},
|
||||
@ -99,7 +94,6 @@ class _CacheViewState extends State<CacheView> {
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension FutureExtension<T> on Future<T> {
|
||||
|
@ -13,15 +13,12 @@ class DebugTile {
|
||||
|
||||
bool devConditionFulfilled() => Provider.of<SettingsProvider>(context, listen: false).val().devToolsEnabled && (onlyInDebug ? kDebugMode : true);
|
||||
|
||||
Widget jsonData(Map<String, dynamic> data, {bool ignoreConfig = false}) {
|
||||
return callback(
|
||||
Widget jsonData(Map<String, dynamic> data, {bool ignoreConfig = false}) => callback(
|
||||
title: 'JSON daten anzeigen',
|
||||
onTab: () => JsonViewer.asDialog(context, data)
|
||||
);
|
||||
}
|
||||
|
||||
Widget callback({String title = 'Debugaktion', required void Function() onTab}) {
|
||||
return child(
|
||||
Widget callback({String title = 'Debugaktion', required void Function() onTab}) => child(
|
||||
ListTile(
|
||||
leading: const CenteredLeading(Icon(Icons.developer_mode_outlined)),
|
||||
title: Text(title),
|
||||
@ -29,17 +26,14 @@ class DebugTile {
|
||||
onTap: onTab,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget child(Widget child) {
|
||||
return Visibility(
|
||||
Widget child(Widget child) => Visibility(
|
||||
visible: devConditionFulfilled(),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
void run(void Function() callback) {
|
||||
if(!devConditionFulfilled()) return;
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,7 @@ class JsonViewer extends StatelessWidget {
|
||||
const JsonViewer({super.key, required this.title, required this.data});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
),
|
||||
@ -19,16 +18,11 @@ class JsonViewer extends StatelessWidget {
|
||||
child: Text(format(data)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static String format(Map<String, dynamic> jsonInput) {
|
||||
return prettyJson(jsonInput, indent: 2);
|
||||
//return jsonInput.replaceAllMapped(RegExp(r'[{,}]'), (match) => "${match.group(0)}\n ");
|
||||
}
|
||||
static String format(Map<String, dynamic> jsonInput) => prettyJson(jsonInput, indent: 2);
|
||||
|
||||
static void asDialog(BuildContext context, Map<String, dynamic> dataMap) {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
showDialog(context: context, builder: (context) => AlertDialog(
|
||||
scrollable: true,
|
||||
title: const Row(children: [Icon(Icons.bug_report_outlined), Text('Rohdaten')]),
|
||||
content: Text(JsonViewer.format(dataMap)),
|
||||
@ -45,7 +39,6 @@ class JsonViewer extends StatelessWidget {
|
||||
}, child: const Text('Inline Kopieren')),
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Schließen'))
|
||||
],
|
||||
);
|
||||
});
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ class FilePick {
|
||||
static final _picker = ImagePicker();
|
||||
|
||||
static Future<XFile?> galleryPick() async {
|
||||
final XFile? pickedImage = await _picker.pickImage(source: ImageSource.gallery);
|
||||
final pickedImage = await _picker.pickImage(source: ImageSource.gallery);
|
||||
if (pickedImage != null) {
|
||||
return pickedImage;
|
||||
}
|
||||
@ -14,8 +14,8 @@ class FilePick {
|
||||
}
|
||||
|
||||
static Future<List<String>?> documentPick() async {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);
|
||||
List<String?>? paths = result?.files.nonNulls.map((e) => e.path).toList();
|
||||
var result = await FilePicker.platform.pickFiles(allowMultiple: true);
|
||||
var paths = result?.files.nonNulls.map((e) => e.path).toList();
|
||||
return paths?.nonNulls.toList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ class _FileViewerState extends State<FileViewer> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppBar appbar({List actions = const []}) {
|
||||
return AppBar(
|
||||
AppBar appbar({List actions = const []}) => AppBar(
|
||||
title: Text(widget.path.split('/').last),
|
||||
actions: [
|
||||
IconButton(
|
||||
@ -57,7 +56,6 @@ class _FileViewerState extends State<FileViewer> {
|
||||
...actions
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
switch(openExternal ? '' : widget.path.split('.').last.toLowerCase()) {
|
||||
case 'png':
|
||||
@ -78,6 +76,8 @@ class _FileViewerState extends State<FileViewer> {
|
||||
backgroundColor: Colors.white,
|
||||
body: PhotoView(
|
||||
controller: photoViewController,
|
||||
maxScale: 3.0,
|
||||
minScale: 0.1,
|
||||
imageProvider: Image.file(File(widget.path)).image,
|
||||
backgroundDecoration: BoxDecoration(color: Theme.of(context).colorScheme.surface),
|
||||
)
|
||||
@ -96,11 +96,9 @@ class _FileViewerState extends State<FileViewer> {
|
||||
OpenFile.open(widget.path).then((result) {
|
||||
Navigator.of(context).pop();
|
||||
if(result.type != ResultType.done) {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
showDialog(context: context, builder: (context) => AlertDialog(
|
||||
content: Text(result.message),
|
||||
);
|
||||
});
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,4 +4,4 @@ class FocusBehaviour {
|
||||
static void textFieldTapOutside(BuildContext context) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ class InfoDialog {
|
||||
contentPadding: const EdgeInsets.all(20),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,7 @@ class LargeProfilePictureView extends StatelessWidget {
|
||||
const LargeProfilePictureView(this.username, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Profilbild'),
|
||||
),
|
||||
@ -18,5 +17,4 @@ class LargeProfilePictureView extends StatelessWidget {
|
||||
backgroundDecoration: BoxDecoration(color: Theme.of(context).colorScheme.surface),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ class _LoadingSpinnerState extends State<LoadingSpinner> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -47,7 +46,6 @@ class _LoadingSpinnerState extends State<LoadingSpinner> {
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
@ -7,8 +7,7 @@ class PlaceholderView extends StatelessWidget {
|
||||
const PlaceholderView({super.key, required this.icon, required this.text, this.button});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTextStyle(
|
||||
Widget build(BuildContext context) => DefaultTextStyle(
|
||||
style: const TextStyle(),
|
||||
child: Center(
|
||||
child: Container(
|
||||
@ -33,5 +32,4 @@ class PlaceholderView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SharePositionOrigin {
|
||||
static Rect get(BuildContext context) {
|
||||
return Rect.fromLTWH(0, 0, MediaQuery.of(context).size.width, MediaQuery.of(context).size.height / 2);
|
||||
}
|
||||
}
|
||||
static Rect get(BuildContext context) => Rect.fromLTWH(0, 0, MediaQuery.of(context).size.width, MediaQuery.of(context).size.height / 2);
|
||||
}
|
||||
|
@ -4,4 +4,4 @@ class UnimplementedDialog {
|
||||
static void show(BuildContext context) {
|
||||
showDialog(context: context, builder: (context) => const AlertDialog(content: Text('Not implemented yet')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user