mirror of
https://github.com/Iconica-Development/flutter_media_picker.git
synced 2025-05-19 00:43:45 +02:00
Merge pull request #1 from Iconica-Development/fix/ontap_custom_header
fix: ontap not working when custom header is set
This commit is contained in:
commit
64fc57a8b9
3 changed files with 57 additions and 43 deletions
|
@ -1,3 +1,11 @@
|
|||
## 0.0.1
|
||||
|
||||
- Initial port
|
||||
|
||||
## 0.0.2
|
||||
|
||||
- Updated flutter_form version
|
||||
|
||||
## 0.0.3
|
||||
|
||||
- Fixed bug where onTap was not working when header is set
|
|
@ -134,14 +134,48 @@ class MediaPicker extends ConsumerWidget {
|
|||
children: [
|
||||
for (final input in inputs) ...[
|
||||
const SizedBox(height: 2.5),
|
||||
header?.call(input.label, input.onPressed) ??
|
||||
header?.call(input.label, (BuildContext ct) async {
|
||||
await onPressedMediaType(ct, input);
|
||||
}) ??
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await onPressedMediaType(context, input);
|
||||
},
|
||||
child: Container(
|
||||
height: 55,
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Color(0xFF979797),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: Text(
|
||||
input.label,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2.5),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> onPressedMediaType(
|
||||
BuildContext context, MediaPickerInput input) async {
|
||||
MediaResult content = await input.onPressed(context);
|
||||
|
||||
if (mediaCheckPage != null &&
|
||||
(input.runtimeType == MediaPickerInputText ||
|
||||
_hasContent(content))) {
|
||||
(input.runtimeType == MediaPickerInputText || _hasContent(content))) {
|
||||
var checkPage = mediaCheckPage!(
|
||||
await input.displayResult(content),
|
||||
input.checkPageSettings,
|
||||
|
@ -178,34 +212,6 @@ class MediaPicker extends ConsumerWidget {
|
|||
onComplete!(content);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: 55,
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Color(0xFF979797),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15),
|
||||
child: Text(
|
||||
input.label,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2.5),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
bool _hasContent(MediaResult content) {
|
||||
|
|
Loading…
Reference in a new issue