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),
|
||||
content: Form(
|
||||
key: _formKey,
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
L10n.global().dateSubtitle,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
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}",
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
L10n.global().dateSubtitle,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().dateYearInputHint,
|
||||
),
|
||||
flex: 1,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().dateMonthInputHint,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
if (int.tryParse(value!)?.inRange(1, 12) == true) {
|
||||
return null;
|
||||
}
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
try {
|
||||
int.parse(value!);
|
||||
return null;
|
||||
} catch (_) {
|
||||
return L10n.global().dateTimeInputInvalid;
|
||||
},
|
||||
onSaved: (value) {
|
||||
_formValue.month = int.parse(value!);
|
||||
},
|
||||
initialValue: widget.initialDateTime.month
|
||||
.toString()
|
||||
.padLeft(2, "0"),
|
||||
}
|
||||
},
|
||||
onSaved: (value) {
|
||||
_formValue.year = int.parse(value!);
|
||||
},
|
||||
initialValue: "${widget.initialDateTime.year}",
|
||||
),
|
||||
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),
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().dateDayInputHint,
|
||||
),
|
||||
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(width: 4),
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().dateDayInputHint,
|
||||
),
|
||||
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"),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
L10n.global().timeSubtitle,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().timeHourInputHint,
|
||||
),
|
||||
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"),
|
||||
flex: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
L10n.global().timeSubtitle,
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().timeHourInputHint,
|
||||
),
|
||||
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),
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().timeMinuteInputHint,
|
||||
),
|
||||
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"),
|
||||
flex: 1,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.global().timeMinuteInputHint,
|
||||
),
|
||||
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),
|
||||
const Flexible(
|
||||
child: SizedBox(),
|
||||
flex: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
flex: 1,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Flexible(
|
||||
child: SizedBox(),
|
||||
flex: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
|
|
|
@ -38,13 +38,11 @@ class PhotoListImage extends StatelessWidget {
|
|||
// won't work on web because the image is downloaded by the cache
|
||||
// manager instead
|
||||
// where's the preview???
|
||||
return Container(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.image_not_supported,
|
||||
size: 64,
|
||||
color: Colors.white.withOpacity(.8),
|
||||
),
|
||||
return Center(
|
||||
child: Icon(
|
||||
Icons.image_not_supported,
|
||||
size: 64,
|
||||
color: Colors.white.withOpacity(.8),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -104,13 +102,11 @@ class PhotoListVideo extends StatelessWidget {
|
|||
errorWidget: (context, url, error) {
|
||||
// no preview for this video. Normal since video preview is disabled
|
||||
// by default
|
||||
return Container(
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.image_not_supported,
|
||||
size: 64,
|
||||
color: Colors.white.withOpacity(.8),
|
||||
),
|
||||
return Center(
|
||||
child: Icon(
|
||||
Icons.image_not_supported,
|
||||
size: 64,
|
||||
color: Colors.white.withOpacity(.8),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -101,12 +101,10 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
|||
_processingSharee.any((element) => element == sharee.shareWith);
|
||||
final Widget trailing;
|
||||
if (isProcessing) {
|
||||
trailing = Container(
|
||||
child: const SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
trailing = const SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
} else {
|
||||
trailing = Checkbox(
|
||||
|
|
|
@ -131,7 +131,7 @@ class _SignInState extends State<SignIn> {
|
|||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 64,
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButtonFormField<_Scheme>(
|
||||
|
|
|
@ -166,74 +166,71 @@ class _VideoViewerState extends State<VideoViewer>
|
|||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: kToolbarHeight + 8, left: 8, right: 8),
|
||||
child: AnimatedVisibility(
|
||||
opacity: widget.isControlVisible ? 1.0 : 0.0,
|
||||
duration: k.animationDurationNormal,
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Row(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: _controller,
|
||||
builder: (context, VideoPlayerValue value, child) =>
|
||||
Text(
|
||||
_durationToString(value.position),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: kToolbarHeight + 8, left: 8, right: 8),
|
||||
child: AnimatedVisibility(
|
||||
opacity: widget.isControlVisible ? 1.0 : 0.0,
|
||||
duration: k.animationDurationNormal,
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Row(
|
||||
children: [
|
||||
ValueListenableBuilder(
|
||||
valueListenable: _controller,
|
||||
builder: (context, VideoPlayerValue value, child) => Text(
|
||||
_durationToString(value.position),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
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(),
|
||||
),
|
||||
ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
height: double.infinity,
|
||||
child: Icon(
|
||||
Icons.image_outlined,
|
||||
|
@ -181,7 +181,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
|||
),
|
||||
if (!widget.file.isOwned(widget.account.username))
|
||||
ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
height: double.infinity,
|
||||
child: Icon(
|
||||
Icons.share_outlined,
|
||||
|
@ -206,7 +206,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
|||
if (widget.file.metadata?.imageWidth != null &&
|
||||
widget.file.metadata?.imageHeight != null)
|
||||
ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
height: double.infinity,
|
||||
child: Icon(
|
||||
Icons.aspect_ratio,
|
||||
|
@ -219,7 +219,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
|||
)
|
||||
else
|
||||
ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
height: double.infinity,
|
||||
child: Icon(
|
||||
Icons.aspect_ratio,
|
||||
|
@ -230,7 +230,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
|||
),
|
||||
if (_model != null)
|
||||
ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
height: double.infinity,
|
||||
child: Icon(
|
||||
Icons.camera_outlined,
|
||||
|
|
Loading…
Reference in a new issue