rework ui
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:convert' show base64Decode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/controller/picture_controller.dart';
|
||||
import 'package:fotodocumentation/dto/picture_dto.dart';
|
||||
import 'package:fotodocumentation/pages/customer/back_button.dart';
|
||||
import 'package:fotodocumentation/pages/customer/picture_delete_dialog.dart';
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -91,20 +92,24 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
}
|
||||
|
||||
var subText = AppLocalizations.of(context)!.customerWidgetCustomerNumberPrefix(dto.customerNumber);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
PageHeaderWidget(text: dto.name, subText: subText),
|
||||
_backButton(context),
|
||||
const SizedBox(height: 24),
|
||||
Expanded(
|
||||
child: _customerWidget(dto),
|
||||
),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
PageHeaderWidget(text: dto.name, subText: subText),
|
||||
CustomerBackButton(path: GlobalRouter.pathHome),
|
||||
//_backButton(context),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
_downloadButton(context),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Expanded(
|
||||
child: _customerWidget(dto),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,6 +175,16 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Bewertung',
|
||||
style: headerStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
@@ -180,7 +195,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 48),
|
||||
const SizedBox(width: 96),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -194,6 +209,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
);
|
||||
|
||||
final dateStr = _dateFormat.format(pictureDto.pictureDate);
|
||||
final evaluationColor = _generalStyle.evaluationColor(); // FIXME: set to color from DB
|
||||
return InkWell(
|
||||
key: Key("table_row_${customerDto.id}"),
|
||||
onTap: () => _actionSelect(context, customerDto, pictureDto),
|
||||
@@ -201,7 +217,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
@@ -223,6 +239,20 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
child: Text(pictureDto.comment ?? "", style: dataStyle),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: evaluationColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Align(
|
||||
@@ -230,6 +260,17 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
child: Text(dateStr, style: dataStyle),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 48,
|
||||
child: IconButton(
|
||||
key: Key("table_row_download_${pictureDto.id}"),
|
||||
icon: Icon(
|
||||
Icons.file_download_outlined,
|
||||
color: _generalStyle.loginFormTextLabelColor,
|
||||
),
|
||||
onPressed: () => _actionDelete(context, customerDto, pictureDto),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 48,
|
||||
child: IconButton(
|
||||
@@ -247,45 +288,9 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _actionDelete(BuildContext context, CustomerDto customerDto, PictureDto pictureDto) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return PictureDeleteDialog();
|
||||
},
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
_pictureController.delete(pictureDto);
|
||||
setState(() {
|
||||
_dto = _customerController.get(id: widget.customerId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _actionSelect(BuildContext context, CustomerDto customerDto, PictureDto pictureDto) async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: _generalStyle.pageBackgroundColor,
|
||||
insetPadding: const EdgeInsets.all(24),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: MediaQuery.of(context).size.height * 0.9,
|
||||
child: PictureWidget(customerDto: customerDto, pictureDto: pictureDto),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _backButton(BuildContext context) {
|
||||
return ElevatedButton.icon(
|
||||
onPressed: () => context.go(GlobalRouter.pathHome),
|
||||
onPressed: () => context.push(GlobalRouter.pathHome),
|
||||
icon: Icon(
|
||||
Icons.chevron_left,
|
||||
color: _generalStyle.secondaryTextLabelColor,
|
||||
@@ -309,4 +314,56 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _downloadButton(BuildContext context) {
|
||||
return ElevatedButton.icon(
|
||||
key: Key("download_all_button"),
|
||||
onPressed: () => _actionDownload(context),
|
||||
iconAlignment: IconAlignment.end,
|
||||
icon: Icon(
|
||||
Icons.file_download_outlined,
|
||||
color: _generalStyle.primaryButtonTextColor,
|
||||
size: 24,
|
||||
),
|
||||
label: Text(
|
||||
"Alle herunterladen",
|
||||
style: TextStyle(
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: _generalStyle.primaryButtonTextColor,
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: _generalStyle.secondaryWidgetBackgroundColor,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
|
||||
shape: const StadiumBorder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _actionDelete(BuildContext context, CustomerDto customerDto, PictureDto pictureDto) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return PictureDeleteDialog();
|
||||
},
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
_pictureController.delete(pictureDto);
|
||||
setState(() {
|
||||
_dto = _customerController.get(id: widget.customerId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _actionSelect(BuildContext context, CustomerDto customerDto, PictureDto pictureDto) async {
|
||||
context.go(GlobalRouter.pathPicture, extra: PictureWidgetHolder(customerDto, pictureDto));
|
||||
}
|
||||
|
||||
Future<void> _actionDownload(BuildContext context) async {
|
||||
// FIXME: implement a download from the export
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user