Remove unnecessary Containers

This commit is contained in:
Ming Ming 2021-09-15 18:50:51 +08:00
parent bc9b2a4c78
commit 94118c4a5b
6 changed files with 203 additions and 216 deletions

View file

@ -23,7 +23,6 @@ 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,
@ -71,9 +70,8 @@ class _PhotoDateTimeEditDialogState extends State<PhotoDateTimeEditDialog> {
onSaved: (value) { onSaved: (value) {
_formValue.month = int.parse(value!); _formValue.month = int.parse(value!);
}, },
initialValue: widget.initialDateTime.month initialValue:
.toString() widget.initialDateTime.month.toString().padLeft(2, "0"),
.padLeft(2, "0"),
), ),
flex: 1, flex: 1,
), ),
@ -122,9 +120,8 @@ class _PhotoDateTimeEditDialogState extends State<PhotoDateTimeEditDialog> {
onSaved: (value) { onSaved: (value) {
_formValue.hour = int.parse(value!); _formValue.hour = int.parse(value!);
}, },
initialValue: widget.initialDateTime.hour initialValue:
.toString() widget.initialDateTime.hour.toString().padLeft(2, "0"),
.padLeft(2, "0"),
), ),
flex: 1, flex: 1,
), ),
@ -160,7 +157,6 @@ class _PhotoDateTimeEditDialogState extends State<PhotoDateTimeEditDialog> {
], ],
), ),
), ),
),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => _onSavePressed(context), onPressed: () => _onSavePressed(context),

View file

@ -38,14 +38,12 @@ 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),
), ),
),
); );
}, },
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
@ -104,14 +102,12 @@ 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),
), ),
),
); );
}, },
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,

View file

@ -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(

View file

@ -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>(

View file

@ -166,8 +166,7 @@ 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(
@ -181,8 +180,7 @@ class _VideoViewerState extends State<VideoViewer>
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: _controller, valueListenable: _controller,
builder: (context, VideoPlayerValue value, child) => builder: (context, VideoPlayerValue value, child) => Text(
Text(
_durationToString(value.position), _durationToString(value.position),
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
@ -238,7 +236,6 @@ class _VideoViewerState extends State<VideoViewer>
), ),
), ),
), ),
),
], ],
); );
} }

View file

@ -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,