diff --git a/lib/widget/photo_date_time_edit_dialog.dart b/lib/widget/photo_date_time_edit_dialog.dart index 5224becf..8495a8f5 100644 --- a/lib/widget/photo_date_time_edit_dialog.dart +++ b/lib/widget/photo_date_time_edit_dialog.dart @@ -23,142 +23,138 @@ class _PhotoDateTimeEditDialogState extends State { 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: [ diff --git a/lib/widget/photo_list_item.dart b/lib/widget/photo_list_item.dart index 0173d979..cecf3fab 100644 --- a/lib/widget/photo_list_item.dart +++ b/lib/widget/photo_list_item.dart @@ -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), ), ); }, diff --git a/lib/widget/share_album_dialog.dart b/lib/widget/share_album_dialog.dart index f3fd4eef..4bb1b5a7 100644 --- a/lib/widget/share_album_dialog.dart +++ b/lib/widget/share_album_dialog.dart @@ -101,12 +101,10 @@ class _ShareAlbumDialogState extends State { _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( diff --git a/lib/widget/sign_in.dart b/lib/widget/sign_in.dart index f991b5e9..d3d30141 100644 --- a/lib/widget/sign_in.dart +++ b/lib/widget/sign_in.dart @@ -131,7 +131,7 @@ class _SignInState extends State { const SizedBox(height: 8), Row( children: [ - Container( + SizedBox( width: 64, child: DropdownButtonHideUnderline( child: DropdownButtonFormField<_Scheme>( diff --git a/lib/widget/video_viewer.dart b/lib/widget/video_viewer.dart index bf08da35..0aac7721 100644 --- a/lib/widget/video_viewer.dart +++ b/lib/widget/video_viewer.dart @@ -166,74 +166,71 @@ class _VideoViewerState extends State ), ), ), - 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), - ), - ), - ), - ), - ], - ), + ), + ], ), ), ), diff --git a/lib/widget/viewer_detail_pane.dart b/lib/widget/viewer_detail_pane.dart index 41d21439..b6c639e4 100644 --- a/lib/widget/viewer_detail_pane.dart +++ b/lib/widget/viewer_detail_pane.dart @@ -169,7 +169,7 @@ class _ViewerDetailPaneState extends State { child: Divider(), ), ListTile( - leading: Container( + leading: SizedBox( height: double.infinity, child: Icon( Icons.image_outlined, @@ -181,7 +181,7 @@ class _ViewerDetailPaneState extends State { ), 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 { 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 { ) else ListTile( - leading: Container( + leading: SizedBox( height: double.infinity, child: Icon( Icons.aspect_ratio, @@ -230,7 +230,7 @@ class _ViewerDetailPaneState extends State { ), if (_model != null) ListTile( - leading: Container( + leading: SizedBox( height: double.infinity, child: Icon( Icons.camera_outlined,