Fixed some coloring issues, respect color theme on file-viewer background, make file-viewer images rotatable
This commit is contained in:
parent
5f163fcffc
commit
731820d480
lib
theming
view/pages
widget
@ -10,10 +10,10 @@ class DarkAppTheme {
|
||||
colorScheme: const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
|
||||
surface: Colors.black,
|
||||
surface: Colors.black54,
|
||||
onSurface: Colors.white,
|
||||
|
||||
primary: Colors.white,
|
||||
primary: marianumRed,
|
||||
onPrimary: Colors.white,
|
||||
|
||||
secondary: Colors.grey,
|
||||
|
@ -16,7 +16,7 @@ class Roomplan extends StatelessWidget {
|
||||
imageProvider: Image.asset("assets/img/raumplan.jpg").image,
|
||||
minScale: 0.5,
|
||||
maxScale: 2.0,
|
||||
backgroundDecoration: const BoxDecoration(color: Colors.white60),
|
||||
backgroundDecoration: BoxDecoration(color: Theme.of(context).colorScheme.surface),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
@ -55,10 +53,10 @@ class _TimetableState extends State<Timetable> {
|
||||
title: const Text("Stunden & Vertretungsplan"),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.home_outlined),
|
||||
onPressed: () {
|
||||
controller.displayDate = DateTime.now().add(const Duration(days: 2));
|
||||
}
|
||||
icon: const Icon(Icons.home_outlined),
|
||||
onPressed: () {
|
||||
controller.displayDate = DateTime.now().add(const Duration(days: 2));
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -102,7 +100,6 @@ class _TimetableState extends State<Timetable> {
|
||||
controller: controller,
|
||||
|
||||
onViewChanged: (ViewChangedDetails details) {
|
||||
log(details.visibleDates.toString());
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
Provider.of<TimetableProps>(context, listen: false).updateWeek(details.visibleDates.first, details.visibleDates.last);
|
||||
});
|
||||
@ -112,7 +109,6 @@ class _TimetableState extends State<Timetable> {
|
||||
if(calendarTapDetails.appointments == null) return;
|
||||
Appointment tapped = calendarTapDetails.appointments!.first;
|
||||
AppointmentDetails.show(context, value, tapped);
|
||||
log(tapped.id.toString());
|
||||
},
|
||||
|
||||
firstDayOfWeek: DateTime.monday,
|
||||
|
@ -11,7 +11,8 @@ import 'placeholderView.dart';
|
||||
class FileViewer extends StatelessWidget {
|
||||
final String path;
|
||||
final bool openExternal;
|
||||
const FileViewer({super.key, required this.path, this.openExternal = false});
|
||||
final bool allowExternal;
|
||||
const FileViewer({super.key, required this.path, this.openExternal = false, this.allowExternal = true});
|
||||
|
||||
|
||||
@override
|
||||
@ -19,15 +20,18 @@ class FileViewer extends StatelessWidget {
|
||||
AppBar appbar = AppBar(
|
||||
title: Text(path.split("/").last),
|
||||
actions: [
|
||||
IconButton(onPressed: () => ConfirmDialog(
|
||||
title: "Extern öffnen",
|
||||
content: "Möchtest du die Datei mit dem Systemdialog öffnen?",
|
||||
onConfirm: () => Navigator.of(context).push(MaterialPageRoute(builder: (context) => FileViewer(path: path, openExternal: true))),
|
||||
confirmButton: "Öffnen",
|
||||
).asDialog(context), icon: const Icon(Icons.open_in_new))
|
||||
Visibility(
|
||||
visible: allowExternal,
|
||||
child: IconButton(onPressed: () => ConfirmDialog(
|
||||
title: "Extern öffnen",
|
||||
content: "Möchtest du die Datei mit dem Systemdialog öffnen?",
|
||||
onConfirm: () => Navigator.of(context).push(MaterialPageRoute(builder: (context) => FileViewer(path: path, openExternal: true))),
|
||||
confirmButton: "Öffnen",
|
||||
).asDialog(context), icon: const Icon(Icons.open_in_new)),
|
||||
)
|
||||
],
|
||||
);
|
||||
switch(openExternal ? "x" : path.split(".").last) {
|
||||
switch(openExternal ? "" : path.split(".").last) {
|
||||
case "png":
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
@ -36,7 +40,8 @@ class FileViewer extends StatelessWidget {
|
||||
backgroundColor: Colors.white,
|
||||
body: PhotoView(
|
||||
imageProvider: Image.file(File(path)).image,
|
||||
backgroundDecoration: const BoxDecoration(color: Colors.white60),
|
||||
backgroundDecoration: BoxDecoration(color: Theme.of(context).colorScheme.surface),
|
||||
enableRotation: true,
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user