fix: comments Jorian

This commit is contained in:
Tim 2022-12-23 15:10:01 +01:00
parent 471724a559
commit 4d9f760418
14 changed files with 61 additions and 43 deletions

View file

@ -1,23 +1,3 @@
## 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
## 0.1.0
- Ability to set styling for the audio input.
## 0.1.1
- Updated flutter_form version to 2.0.1
## 0.2.0 ## 0.2.0
- Added option to select a file - Added option to select a file
- Added file_picker package for file picking possibility - Added file_picker package for file picking possibility
@ -26,3 +6,23 @@
- Icons are customizable - Icons are customizable
- When using standard icon buttons delivered with this package you can set the icon text, icon text size, icon and icon size - When using standard icon buttons delivered with this package you can set the icon text, icon text size, icon and icon size
- Translated the example to English - Translated the example to English
## 0.1.1
- Updated flutter_form version to 2.0.1
## 0.1.0
- Ability to set styling for the audio input.
## 0.0.3
- Fixed bug where onTap was not working when header is set
## 0.0.2
- Updated flutter_form version
## 0.0.1
- Initial port

View file

@ -70,7 +70,7 @@ class _MediaCheckPageState extends State<MediaCheckPage> {
widget.cancel(); widget.cancel();
formController.autoNextStep(); formController.autoNextStep();
}, },
child: const Text("Share"), child: const Text('Share'),
), ),
), ),
), ),
@ -140,7 +140,7 @@ class _MediaCheckPageState extends State<MediaCheckPage> {
), ),
Expanded( Expanded(
child: FlutterFormInputMultiLine( child: FlutterFormInputMultiLine(
hint: "Add description...", hint: 'Add description...',
maxCharacters: 300, maxCharacters: 300,
controller: descriptionController), controller: descriptionController),
), ),

View file

@ -65,10 +65,10 @@ class _MediaPickerIconOptionsState extends ConsumerState<MediaPickerPageIconOpti
verticalSpacing: 20, verticalSpacing: 20,
mediaPickerInputs: [ mediaPickerInputs: [
MediaPickerInputPhoto( MediaPickerInputPhoto(
label: "Make photo", label: 'Make photo',
icon: const IconButtonWithText( icon: const IconButtonWithText(
icon: Icons.camera_alt, icon: Icons.camera_alt,
iconText: "Custom Photo Icon", iconText: 'Custom Photo Icon',
), ),
pickFile: mediaService.pickImageFile, pickFile: mediaService.pickImageFile,
checkPageSettings: { checkPageSettings: {
@ -81,7 +81,7 @@ class _MediaPickerIconOptionsState extends ConsumerState<MediaPickerPageIconOpti
}, },
), ),
MediaPickerInputVideo( MediaPickerInputVideo(
label: "Make video", label: 'Make video',
pickFile: mediaService.pickVideoFile, pickFile: mediaService.pickVideoFile,
videoPlayerFactory: MediaPickerVideoPlayerFactory(), videoPlayerFactory: MediaPickerVideoPlayerFactory(),
checkPageSettings: { checkPageSettings: {
@ -95,7 +95,7 @@ class _MediaPickerIconOptionsState extends ConsumerState<MediaPickerPageIconOpti
), ),
if (!kIsWeb) if (!kIsWeb)
MediaPickerInputAudio( MediaPickerInputAudio(
label: "Record audio", label: 'Record audio',
checkPageSettings: {'title': 'Share audio'}, checkPageSettings: {'title': 'Share audio'},
onComplete: (MediaResult result) { onComplete: (MediaResult result) {
Navigator.pop(context); Navigator.pop(context);
@ -103,14 +103,14 @@ class _MediaPickerIconOptionsState extends ConsumerState<MediaPickerPageIconOpti
audioService: audioService, audioService: audioService,
), ),
MediaPickerInputText( MediaPickerInputText(
label: "Write text", label: 'Write text',
checkPageSettings: {'title': 'Share text'}, checkPageSettings: {'title': 'Share text'},
onComplete: (MediaResult result) { onComplete: (MediaResult result) {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
MediaPickerInputFile( MediaPickerInputFile(
label: "Select file", label: 'Select file',
pickFile: mediaService.pickFile, pickFile: mediaService.pickFile,
fileExtensions: [ fileExtensions: [
'pdf', 'pdf',

View file

@ -63,7 +63,7 @@ class _MediaPickerTextOptionsState extends ConsumerState<MediaPickerPageTextOpti
buttonType: ButtonType.text, buttonType: ButtonType.text,
mediaPickerInputs: [ mediaPickerInputs: [
MediaPickerInputPhoto( MediaPickerInputPhoto(
label: "Make photo", label: 'Make photo',
pickFile: mediaService.pickImageFile, pickFile: mediaService.pickImageFile,
checkPageSettings: { checkPageSettings: {
'title': 'Share photo', 'title': 'Share photo',
@ -75,7 +75,7 @@ class _MediaPickerTextOptionsState extends ConsumerState<MediaPickerPageTextOpti
}, },
), ),
MediaPickerInputVideo( MediaPickerInputVideo(
label: "Make video", label: 'Make video',
pickFile: mediaService.pickVideoFile, pickFile: mediaService.pickVideoFile,
videoPlayerFactory: MediaPickerVideoPlayerFactory(), videoPlayerFactory: MediaPickerVideoPlayerFactory(),
checkPageSettings: { checkPageSettings: {
@ -89,7 +89,7 @@ class _MediaPickerTextOptionsState extends ConsumerState<MediaPickerPageTextOpti
), ),
if (!kIsWeb) if (!kIsWeb)
MediaPickerInputAudio( MediaPickerInputAudio(
label: "Record audio", label: 'Record audio',
checkPageSettings: {'title': 'Share audio'}, checkPageSettings: {'title': 'Share audio'},
onComplete: (MediaResult result) { onComplete: (MediaResult result) {
Navigator.pop(context); Navigator.pop(context);
@ -97,14 +97,14 @@ class _MediaPickerTextOptionsState extends ConsumerState<MediaPickerPageTextOpti
audioService: audioService, audioService: audioService,
), ),
MediaPickerInputText( MediaPickerInputText(
label: "Write text", label: 'Write text',
checkPageSettings: {'title': 'Share text'}, checkPageSettings: {'title': 'Share text'},
onComplete: (MediaResult result) { onComplete: (MediaResult result) {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
MediaPickerInputFile( MediaPickerInputFile(
label: "Select file", label: 'Select file',
pickFile: mediaService.pickFile, pickFile: mediaService.pickFile,
fileExtensions: [ fileExtensions: [
'pdf', 'pdf',

View file

@ -23,7 +23,7 @@ import 'package:flutter_media_picker/src/widgets/icon_button_with_text.dart';
/// [onComplete] will be called when the user has selected/made the media. /// [onComplete] will be called when the user has selected/made the media.
/// If checkpage is set this method will be called when the [onComplete] is called in the checkPage. /// If checkpage is set this method will be called when the [onComplete] is called in the checkPage.
abstract class MediaPickerInput { abstract class MediaPickerInput {
String label = "Media Picker input"; String label = 'Media Picker input';
Widget icon = const IconButtonWithText(); Widget icon = const IconButtonWithText();

View file

@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
enum ButtonType { enum ButtonType {
icons, icons,
text, text,

View file

@ -1 +1,5 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
export 'button_type.dart'; export 'button_type.dart';

View file

@ -15,7 +15,7 @@ import 'package:intl/intl.dart';
/// This feature is only usable for native applications. /// This feature is only usable for native applications.
class MediaPickerInputAudio implements MediaPickerInput { class MediaPickerInputAudio implements MediaPickerInput {
MediaPickerInputAudio({ MediaPickerInputAudio({
this.label = "Audio", this.label = 'Audio',
Widget? icon, Widget? icon,
this.checkPageSettings, this.checkPageSettings,
this.onComplete, this.onComplete,
@ -50,7 +50,7 @@ class MediaPickerInputAudio implements MediaPickerInput {
if (content.fileValue != null) { if (content.fileValue != null) {
audio = content; audio = content;
} else { } else {
throw Exception("No recording returned"); throw Exception('No recording returned');
} }
}, },
inputStyling: inputStyling ?? AudioInputStyling(), inputStyling: inputStyling ?? AudioInputStyling(),

View file

@ -2,6 +2,9 @@
// //
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
import 'dart:io';
import 'dart:typed_data';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -12,7 +15,7 @@ import '../../flutter_media_picker.dart';
/// Input for file used by [MediaPicker]. /// Input for file used by [MediaPicker].
class MediaPickerInputFile implements MediaPickerInput { class MediaPickerInputFile implements MediaPickerInput {
MediaPickerInputFile({ MediaPickerInputFile({
this.label = "File", this.label = 'File',
Widget? icon, Widget? icon,
this.fileExtensions = const ['pdf', 'jpg', 'png'], this.fileExtensions = const ['pdf', 'jpg', 'png'],
this.checkPageSettings, this.checkPageSettings,
@ -65,9 +68,8 @@ class MediaPickerInputFile implements MediaPickerInput {
case '.pdf': case '.pdf':
case '.doc': case '.doc':
case '.docx': case '.docx':
return Text(result.fileName!);
case '.txt': case '.txt':
return const DisplayText(); return Text(result.fileName!);
default: default:
} }
} }

View file

@ -13,7 +13,7 @@ import 'package:flutter_media_picker/src/widgets/icon_button_with_text.dart';
/// Input for photo used by [MediaPicker]. /// Input for photo used by [MediaPicker].
class MediaPickerInputPhoto implements MediaPickerInput { class MediaPickerInputPhoto implements MediaPickerInput {
MediaPickerInputPhoto({ MediaPickerInputPhoto({
this.label = "Photo", this.label = 'Photo',
Widget? icon, Widget? icon,
this.checkPageSettings, this.checkPageSettings,
this.onComplete, this.onComplete,

View file

@ -12,7 +12,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
/// Input for text used by [MediaPicker]. /// Input for text used by [MediaPicker].
class MediaPickerInputText implements MediaPickerInput { class MediaPickerInputText implements MediaPickerInput {
MediaPickerInputText({ MediaPickerInputText({
this.label = "Text", this.label = 'Text',
Widget? icon, Widget? icon,
this.checkPageSettings, this.checkPageSettings,
this.onComplete, this.onComplete,

View file

@ -10,7 +10,7 @@ import 'package:flutter_media_picker/flutter_media_picker.dart';
/// Input for video used by [MediaPicker]. /// Input for video used by [MediaPicker].
class MediaPickerInputVideo implements MediaPickerInput { class MediaPickerInputVideo implements MediaPickerInput {
MediaPickerInputVideo({ MediaPickerInputVideo({
this.label = "Video", this.label = 'Video',
Widget? icon, Widget? icon,
this.checkPageSettings, this.checkPageSettings,
this.onComplete, this.onComplete,

View file

@ -1,10 +1,14 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class IconButtonWithText extends StatelessWidget { class IconButtonWithText extends StatelessWidget {
const IconButtonWithText({ const IconButtonWithText({
super.key, super.key,
this.iconSize = 40, this.iconSize = 40,
this.iconText = "Button", this.iconText = 'Button',
this.iconTextSize = 16, this.iconTextSize = 16,
this.icon = Icons.file_copy, this.icon = Icons.file_copy,
}); });

View file

@ -1 +1,5 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
export 'icon_button_with_text.dart'; export 'icon_button_with_text.dart';