@@ -80,113 +80,88 @@ class _CoverImagePickerState extends State<CoverImagePicker> {
8080 }
8181
8282 double get _coverWidth =>
83- widget.coverWidth ?? (widget.isDesktop ? 280.0 : 150 .0 );
83+ widget.coverWidth ?? (widget.isDesktop ? 280.0 : 180 .0 );
8484 double get _coverHeight =>
85- widget.coverHeight ?? (widget.isDesktop ? 420.0 : 225.0 );
86- // Mobile controls width for comfortable touch targets
87- double get _mobileControlsWidth => 280.0 ;
88-
89- /// On desktop, let widget stretch to fill container.
90- /// On mobile, constrain to fixed width.
91- Widget _wrapWithWidth (Widget child) {
92- if (widget.isDesktop) {
93- return child;
94- }
95- return SizedBox (width: _mobileControlsWidth, child: child);
96- }
85+ widget.coverHeight ?? (widget.isDesktop ? 420.0 : 270.0 );
9786
9887 @override
9988 Widget build (BuildContext context) {
10089 final colorScheme = Theme .of (context).colorScheme;
10190
10291 return Column (
103- // On desktop, stretch controls to fill container width
104- crossAxisAlignment: widget.isDesktop
105- ? CrossAxisAlignment .stretch
106- : CrossAxisAlignment .center,
92+ crossAxisAlignment: CrossAxisAlignment .stretch,
10793 children: [
10894 // Cover preview (always centered)
10995 Center (child: _buildCoverPreview (context)),
11096 SizedBox (height: widget.isDesktop ? Spacing .md : Spacing .lg),
11197
11298 // Action buttons
113- _wrapWithWidth (
114- Row (
115- children: [
116- Expanded (
117- child: OutlinedButton .icon (
118- onPressed: _pickImage,
119- icon: const Icon (Icons .upload, size: 18 ),
120- label: const Text ('Upload' ),
121- style: OutlinedButton .styleFrom (
122- padding: EdgeInsets .symmetric (
123- vertical: widget.isDesktop ? 8 : 12 ,
124- ),
125- ),
99+ Row (
100+ children: [
101+ Expanded (
102+ child: OutlinedButton .icon (
103+ onPressed: _pickImage,
104+ icon: const Icon (Icons .upload, size: 18 ),
105+ label: const Text ('Upload' ),
106+ style: OutlinedButton .styleFrom (
107+ padding: const EdgeInsets .symmetric (vertical: 12 ),
126108 ),
127109 ),
128- SizedBox (width: widget.isDesktop ? Spacing .md : Spacing .md),
129- Expanded (
130- child: OutlinedButton .icon (
131- onPressed: () =>
132- setState (() => _showUrlInput = ! _showUrlInput),
133- icon: const Icon (Icons .link, size: 18 ),
134- label: const Text ('URL' ),
135- style: OutlinedButton .styleFrom (
136- padding: EdgeInsets .symmetric (
137- vertical: widget.isDesktop ? 8 : 12 ,
138- ),
139- backgroundColor: _showUrlInput
140- ? colorScheme.secondaryContainer
141- : null ,
142- ),
110+ ),
111+ const SizedBox (width: Spacing .md),
112+ Expanded (
113+ child: OutlinedButton .icon (
114+ onPressed: () => setState (() => _showUrlInput = ! _showUrlInput),
115+ icon: const Icon (Icons .link, size: 18 ),
116+ label: const Text ('URL' ),
117+ style: OutlinedButton .styleFrom (
118+ padding: const EdgeInsets .symmetric (vertical: 12 ),
119+ backgroundColor: _showUrlInput
120+ ? colorScheme.secondaryContainer
121+ : null ,
143122 ),
144123 ),
145- ] ,
146- ) ,
124+ ) ,
125+ ] ,
147126 ),
148127
149128 // URL input
150129 if (_showUrlInput) ...[
151130 const SizedBox (height: Spacing .md),
152- _wrapWithWidth (
153- TextField (
154- controller: _urlController,
155- decoration: InputDecoration (
156- labelText: 'Image URL' ,
157- hintText: 'https://...' ,
158- isDense: true ,
159- border: OutlineInputBorder (
160- borderRadius: BorderRadius .circular (AppRadius .md),
161- ),
162- suffixIcon: _urlController.text.isNotEmpty
163- ? IconButton (
164- icon: const Icon (Icons .clear, size: 20 ),
165- onPressed: () {
166- _urlController.clear ();
167- _onUrlChanged ('' );
168- },
169- tooltip: 'Clear URL' ,
170- )
171- : null ,
131+ TextField (
132+ controller: _urlController,
133+ decoration: InputDecoration (
134+ labelText: 'Image URL' ,
135+ hintText: 'https://...' ,
136+ isDense: true ,
137+ border: OutlineInputBorder (
138+ borderRadius: BorderRadius .circular (AppRadius .md),
172139 ),
173- keyboardType: TextInputType .url,
174- style: Theme .of (context).textTheme.bodySmall,
175- onChanged: _onUrlChanged,
176- onSubmitted: (_) => _applyUrl (),
140+ suffixIcon: _urlController.text.isNotEmpty
141+ ? IconButton (
142+ icon: const Icon (Icons .clear, size: 20 ),
143+ onPressed: () {
144+ _urlController.clear ();
145+ _onUrlChanged ('' );
146+ },
147+ tooltip: 'Clear URL' ,
148+ )
149+ : null ,
177150 ),
151+ keyboardType: TextInputType .url,
152+ style: Theme .of (context).textTheme.bodySmall,
153+ onChanged: _onUrlChanged,
154+ onSubmitted: (_) => _applyUrl (),
178155 ),
179156 ],
180157
181158 // Error message
182159 if (_error != null ) ...[
183160 const SizedBox (height: Spacing .sm),
184- _wrapWithWidth (
185- Text (
186- _error! ,
187- style: TextStyle (color: colorScheme.error, fontSize: 12 ),
188- textAlign: TextAlign .center,
189- ),
161+ Text (
162+ _error! ,
163+ style: TextStyle (color: colorScheme.error, fontSize: 12 ),
164+ textAlign: TextAlign .center,
190165 ),
191166 ],
192167 ],
0 commit comments