mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
Remove unnecessary Containers
This commit is contained in:
parent
bc9b2a4c78
commit
94118c4a5b
6 changed files with 203 additions and 216 deletions
|
@ -23,142 +23,138 @@ class _PhotoDateTimeEditDialogState extends State<PhotoDateTimeEditDialog> {
|
||||||
title: Text(L10n.global().updateDateTimeDialogTitle),
|
title: Text(L10n.global().updateDateTimeDialogTitle),
|
||||||
content: Form(
|
content: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Container(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Text(
|
L10n.global().dateSubtitle,
|
||||||
L10n.global().dateSubtitle,
|
style: Theme.of(context).textTheme.subtitle2,
|
||||||
style: Theme.of(context).textTheme.subtitle2,
|
),
|
||||||
),
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Flexible(
|
||||||
Flexible(
|
child: TextFormField(
|
||||||
child: TextFormField(
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
hintText: L10n.global().dateYearInputHint,
|
||||||
hintText: L10n.global().dateYearInputHint,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
validator: (value) {
|
|
||||||
try {
|
|
||||||
int.parse(value!);
|
|
||||||
return null;
|
|
||||||
} catch (_) {
|
|
||||||
return L10n.global().dateTimeInputInvalid;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSaved: (value) {
|
|
||||||
_formValue.year = int.parse(value!);
|
|
||||||
},
|
|
||||||
initialValue: "${widget.initialDateTime.year}",
|
|
||||||
),
|
),
|
||||||
flex: 1,
|
keyboardType: TextInputType.number,
|
||||||
),
|
validator: (value) {
|
||||||
const SizedBox(width: 4),
|
try {
|
||||||
Flexible(
|
int.parse(value!);
|
||||||
child: TextFormField(
|
return null;
|
||||||
decoration: InputDecoration(
|
} catch (_) {
|
||||||
hintText: L10n.global().dateMonthInputHint,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
validator: (value) {
|
|
||||||
if (int.tryParse(value!)?.inRange(1, 12) == true) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return L10n.global().dateTimeInputInvalid;
|
return L10n.global().dateTimeInputInvalid;
|
||||||
},
|
}
|
||||||
onSaved: (value) {
|
},
|
||||||
_formValue.month = int.parse(value!);
|
onSaved: (value) {
|
||||||
},
|
_formValue.year = int.parse(value!);
|
||||||
initialValue: widget.initialDateTime.month
|
},
|
||||||
.toString()
|
initialValue: "${widget.initialDateTime.year}",
|
||||||
.padLeft(2, "0"),
|
),
|
||||||
|
flex: 1,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Flexible(
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: L10n.global().dateMonthInputHint,
|
||||||
),
|
),
|
||||||
flex: 1,
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (value) {
|
||||||
|
if (int.tryParse(value!)?.inRange(1, 12) == true) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return L10n.global().dateTimeInputInvalid;
|
||||||
|
},
|
||||||
|
onSaved: (value) {
|
||||||
|
_formValue.month = int.parse(value!);
|
||||||
|
},
|
||||||
|
initialValue:
|
||||||
|
widget.initialDateTime.month.toString().padLeft(2, "0"),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
flex: 1,
|
||||||
Flexible(
|
),
|
||||||
child: TextFormField(
|
const SizedBox(width: 4),
|
||||||
decoration: InputDecoration(
|
Flexible(
|
||||||
hintText: L10n.global().dateDayInputHint,
|
child: TextFormField(
|
||||||
),
|
decoration: InputDecoration(
|
||||||
keyboardType: TextInputType.number,
|
hintText: L10n.global().dateDayInputHint,
|
||||||
validator: (value) {
|
|
||||||
if (int.tryParse(value!)?.inRange(1, 31) == true) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return L10n.global().dateTimeInputInvalid;
|
|
||||||
},
|
|
||||||
onSaved: (value) {
|
|
||||||
_formValue.day = int.parse(value!);
|
|
||||||
},
|
|
||||||
initialValue:
|
|
||||||
widget.initialDateTime.day.toString().padLeft(2, "0"),
|
|
||||||
),
|
),
|
||||||
flex: 1,
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (value) {
|
||||||
|
if (int.tryParse(value!)?.inRange(1, 31) == true) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return L10n.global().dateTimeInputInvalid;
|
||||||
|
},
|
||||||
|
onSaved: (value) {
|
||||||
|
_formValue.day = int.parse(value!);
|
||||||
|
},
|
||||||
|
initialValue:
|
||||||
|
widget.initialDateTime.day.toString().padLeft(2, "0"),
|
||||||
),
|
),
|
||||||
],
|
flex: 1,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
],
|
||||||
Text(
|
),
|
||||||
L10n.global().timeSubtitle,
|
const SizedBox(height: 16),
|
||||||
style: Theme.of(context).textTheme.subtitle2,
|
Text(
|
||||||
),
|
L10n.global().timeSubtitle,
|
||||||
Row(
|
style: Theme.of(context).textTheme.subtitle2,
|
||||||
children: [
|
),
|
||||||
Flexible(
|
Row(
|
||||||
child: TextFormField(
|
children: [
|
||||||
decoration: InputDecoration(
|
Flexible(
|
||||||
hintText: L10n.global().timeHourInputHint,
|
child: TextFormField(
|
||||||
),
|
decoration: InputDecoration(
|
||||||
keyboardType: TextInputType.number,
|
hintText: L10n.global().timeHourInputHint,
|
||||||
validator: (value) {
|
|
||||||
if (int.tryParse(value!)?.inRange(0, 23) == true) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return L10n.global().dateTimeInputInvalid;
|
|
||||||
},
|
|
||||||
onSaved: (value) {
|
|
||||||
_formValue.hour = int.parse(value!);
|
|
||||||
},
|
|
||||||
initialValue: widget.initialDateTime.hour
|
|
||||||
.toString()
|
|
||||||
.padLeft(2, "0"),
|
|
||||||
),
|
),
|
||||||
flex: 1,
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (value) {
|
||||||
|
if (int.tryParse(value!)?.inRange(0, 23) == true) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return L10n.global().dateTimeInputInvalid;
|
||||||
|
},
|
||||||
|
onSaved: (value) {
|
||||||
|
_formValue.hour = int.parse(value!);
|
||||||
|
},
|
||||||
|
initialValue:
|
||||||
|
widget.initialDateTime.hour.toString().padLeft(2, "0"),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
flex: 1,
|
||||||
Flexible(
|
),
|
||||||
child: TextFormField(
|
const SizedBox(width: 4),
|
||||||
decoration: InputDecoration(
|
Flexible(
|
||||||
hintText: L10n.global().timeMinuteInputHint,
|
child: TextFormField(
|
||||||
),
|
decoration: InputDecoration(
|
||||||
keyboardType: TextInputType.number,
|
hintText: L10n.global().timeMinuteInputHint,
|
||||||
validator: (value) {
|
|
||||||
if (int.tryParse(value!)?.inRange(0, 59) == true) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return L10n.global().dateTimeInputInvalid;
|
|
||||||
},
|
|
||||||
onSaved: (value) {
|
|
||||||
_formValue.minute = int.parse(value!);
|
|
||||||
},
|
|
||||||
initialValue: widget.initialDateTime.minute
|
|
||||||
.toString()
|
|
||||||
.padLeft(2, "0"),
|
|
||||||
),
|
),
|
||||||
flex: 1,
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (value) {
|
||||||
|
if (int.tryParse(value!)?.inRange(0, 59) == true) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return L10n.global().dateTimeInputInvalid;
|
||||||
|
},
|
||||||
|
onSaved: (value) {
|
||||||
|
_formValue.minute = int.parse(value!);
|
||||||
|
},
|
||||||
|
initialValue: widget.initialDateTime.minute
|
||||||
|
.toString()
|
||||||
|
.padLeft(2, "0"),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
flex: 1,
|
||||||
const Flexible(
|
),
|
||||||
child: SizedBox(),
|
const SizedBox(width: 4),
|
||||||
flex: 1,
|
const Flexible(
|
||||||
),
|
child: SizedBox(),
|
||||||
],
|
flex: 1,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
|
@ -38,13 +38,11 @@ class PhotoListImage extends StatelessWidget {
|
||||||
// won't work on web because the image is downloaded by the cache
|
// won't work on web because the image is downloaded by the cache
|
||||||
// manager instead
|
// manager instead
|
||||||
// where's the preview???
|
// where's the preview???
|
||||||
return Container(
|
return Center(
|
||||||
child: Center(
|
child: Icon(
|
||||||
child: Icon(
|
Icons.image_not_supported,
|
||||||
Icons.image_not_supported,
|
size: 64,
|
||||||
size: 64,
|
color: Colors.white.withOpacity(.8),
|
||||||
color: Colors.white.withOpacity(.8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -104,13 +102,11 @@ class PhotoListVideo extends StatelessWidget {
|
||||||
errorWidget: (context, url, error) {
|
errorWidget: (context, url, error) {
|
||||||
// no preview for this video. Normal since video preview is disabled
|
// no preview for this video. Normal since video preview is disabled
|
||||||
// by default
|
// by default
|
||||||
return Container(
|
return Center(
|
||||||
child: Center(
|
child: Icon(
|
||||||
child: Icon(
|
Icons.image_not_supported,
|
||||||
Icons.image_not_supported,
|
size: 64,
|
||||||
size: 64,
|
color: Colors.white.withOpacity(.8),
|
||||||
color: Colors.white.withOpacity(.8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -101,12 +101,10 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
||||||
_processingSharee.any((element) => element == sharee.shareWith);
|
_processingSharee.any((element) => element == sharee.shareWith);
|
||||||
final Widget trailing;
|
final Widget trailing;
|
||||||
if (isProcessing) {
|
if (isProcessing) {
|
||||||
trailing = Container(
|
trailing = const SizedBox(
|
||||||
child: const SizedBox(
|
width: 24,
|
||||||
width: 24,
|
height: 24,
|
||||||
height: 24,
|
child: CircularProgressIndicator(),
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
trailing = Checkbox(
|
trailing = Checkbox(
|
||||||
|
|
|
@ -131,7 +131,7 @@ class _SignInState extends State<SignIn> {
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
SizedBox(
|
||||||
width: 64,
|
width: 64,
|
||||||
child: DropdownButtonHideUnderline(
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButtonFormField<_Scheme>(
|
child: DropdownButtonFormField<_Scheme>(
|
||||||
|
|
|
@ -166,74 +166,71 @@ class _VideoViewerState extends State<VideoViewer>
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Align(
|
||||||
child: Align(
|
alignment: Alignment.bottomCenter,
|
||||||
alignment: Alignment.bottomCenter,
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.only(
|
||||||
padding: const EdgeInsets.only(
|
bottom: kToolbarHeight + 8, left: 8, right: 8),
|
||||||
bottom: kToolbarHeight + 8, left: 8, right: 8),
|
child: AnimatedVisibility(
|
||||||
child: AnimatedVisibility(
|
opacity: widget.isControlVisible ? 1.0 : 0.0,
|
||||||
opacity: widget.isControlVisible ? 1.0 : 0.0,
|
duration: k.animationDurationNormal,
|
||||||
duration: k.animationDurationNormal,
|
child: Material(
|
||||||
child: Material(
|
type: MaterialType.transparency,
|
||||||
type: MaterialType.transparency,
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
ValueListenableBuilder(
|
||||||
ValueListenableBuilder(
|
valueListenable: _controller,
|
||||||
valueListenable: _controller,
|
builder: (context, VideoPlayerValue value, child) => Text(
|
||||||
builder: (context, VideoPlayerValue value, child) =>
|
_durationToString(value.position),
|
||||||
Text(
|
style: TextStyle(
|
||||||
_durationToString(value.position),
|
fontSize: 14,
|
||||||
style: TextStyle(
|
color: AppTheme.getSecondaryTextColor(context),
|
||||||
fontSize: 14,
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: VideoProgressIndicator(
|
||||||
|
_controller,
|
||||||
|
allowScrubbing: true,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
colors: const VideoProgressColors(
|
||||||
|
backgroundColor: Colors.white24,
|
||||||
|
bufferedColor: Colors.white38,
|
||||||
|
playedColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
if (_controller.value.duration != Duration.zero)
|
||||||
|
Text(
|
||||||
|
_durationToString(_controller.value.duration),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: AppTheme.getSecondaryTextColor(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Tooltip(
|
||||||
|
message: _controller.value.volume == 0
|
||||||
|
? L10n.global().unmuteTooltip
|
||||||
|
: L10n.global().muteTooltip,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius:
|
||||||
|
const BorderRadius.all(Radius.circular(32)),
|
||||||
|
onTap: _onVolumnPressed,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: Icon(
|
||||||
|
_controller.value.volume == 0
|
||||||
|
? Icons.volume_mute_outlined
|
||||||
|
: Icons.volume_up_outlined,
|
||||||
color: AppTheme.getSecondaryTextColor(context),
|
color: AppTheme.getSecondaryTextColor(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
),
|
||||||
Expanded(
|
],
|
||||||
child: VideoProgressIndicator(
|
|
||||||
_controller,
|
|
||||||
allowScrubbing: true,
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
||||||
colors: const VideoProgressColors(
|
|
||||||
backgroundColor: Colors.white24,
|
|
||||||
bufferedColor: Colors.white38,
|
|
||||||
playedColor: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
if (_controller.value.duration != Duration.zero)
|
|
||||||
Text(
|
|
||||||
_durationToString(_controller.value.duration),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: AppTheme.getSecondaryTextColor(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Tooltip(
|
|
||||||
message: _controller.value.volume == 0
|
|
||||||
? L10n.global().unmuteTooltip
|
|
||||||
: L10n.global().muteTooltip,
|
|
||||||
child: InkWell(
|
|
||||||
borderRadius:
|
|
||||||
const BorderRadius.all(Radius.circular(32)),
|
|
||||||
onTap: _onVolumnPressed,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
child: Icon(
|
|
||||||
_controller.value.volume == 0
|
|
||||||
? Icons.volume_mute_outlined
|
|
||||||
: Icons.volume_up_outlined,
|
|
||||||
color: AppTheme.getSecondaryTextColor(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -169,7 +169,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
child: Divider(),
|
child: Divider(),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Container(
|
leading: SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.image_outlined,
|
Icons.image_outlined,
|
||||||
|
@ -181,7 +181,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
),
|
),
|
||||||
if (!widget.file.isOwned(widget.account.username))
|
if (!widget.file.isOwned(widget.account.username))
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Container(
|
leading: SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.share_outlined,
|
Icons.share_outlined,
|
||||||
|
@ -206,7 +206,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
if (widget.file.metadata?.imageWidth != null &&
|
if (widget.file.metadata?.imageWidth != null &&
|
||||||
widget.file.metadata?.imageHeight != null)
|
widget.file.metadata?.imageHeight != null)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Container(
|
leading: SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.aspect_ratio,
|
Icons.aspect_ratio,
|
||||||
|
@ -219,7 +219,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Container(
|
leading: SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.aspect_ratio,
|
Icons.aspect_ratio,
|
||||||
|
@ -230,7 +230,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
),
|
),
|
||||||
if (_model != null)
|
if (_model != null)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Container(
|
leading: SizedBox(
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.camera_outlined,
|
Icons.camera_outlined,
|
||||||
|
|
Loading…
Reference in a new issue