mirror of
https://github.com/Iconica-Development/flutter_input_library.git
synced 2025-05-19 01:13:45 +02:00
Updated README, added GIF, updated example, added Github Actions and Depandabot
This commit is contained in:
parent
13067633de
commit
5afec94105
13 changed files with 155 additions and 48 deletions
10
.github/dependabot.yaml
vendored
Normal file
10
.github/dependabot.yaml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "pub"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
32
.github/workflows/flutter.yml
vendored
Normal file
32
.github/workflows/flutter.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- feature/*
|
||||
- bugfix/*
|
||||
- hotfix/*
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/wrapper
|
||||
/opt/hostedtoolcache/flutter
|
||||
key: ${{ runner.OS }}-flutter-install-cache
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: 'stable'
|
||||
- name: Flutter pub get
|
||||
run: flutter pub get
|
||||
- name: Flutter format
|
||||
run: flutter format -o none --set-exit-if-changed .
|
||||
- name: Flutter analyze
|
||||
run: flutter analyze
|
|
@ -1,3 +1,7 @@
|
|||
## 0.0.1
|
||||
|
||||
* Initial release, retrieved inputs from flutter_form
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* enforce 24h clock in the time picker because it can caused a bug on web
|
12
README.md
12
README.md
|
@ -1,14 +1,18 @@
|
|||
[](https://github.com/tenhobi/effective_dart)
|
||||
[](https://github.com/Iconica-Development) [](https://github.com/Iconica-Development/flutter_input_library/actions/new) [](https://github.com/tenhobi/effective_dart)
|
||||
|
||||
Generic input library for Flutter.
|
||||
# Flutter Input Library
|
||||
|
||||
Input library for Flutter to make creating form inputs a little easier.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
Add `flutter_input_library` to your `pubspec.yaml`:
|
||||
To use this package, add `flutter_input_library` as a dependency in your pubspec.yaml file.
|
||||
|
||||
## How to use
|
||||
|
||||
Look at the example for a simple [example](./example/lib/main.dart)
|
||||
See the [Example Code](example/lib/main.dart) for an example on how to use this package.
|
||||
|
||||
## Issues
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# This file should be version controlled.
|
||||
|
||||
version:
|
||||
revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
revision: 135454af32477f815a7525073027a3ff9eff1bfd
|
||||
channel: stable
|
||||
|
||||
project_type: app
|
||||
|
@ -13,26 +13,11 @@ project_type: app
|
|||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: android
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
|
||||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
|
||||
- platform: ios
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: linux
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: macos
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: web
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
- platform: windows
|
||||
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
|
||||
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
|
||||
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
|
||||
|
||||
# User provided section
|
||||
|
||||
|
|
16
example/README.md
Normal file
16
example/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# example
|
||||
|
||||
A new Flutter project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
|
@ -50,35 +50,45 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(height: 10),
|
||||
const Text('FlutterFormInputSwitch'),
|
||||
FlutterFormInputSwitch(
|
||||
initialValue: true,
|
||||
onChanged: (v) {
|
||||
print('Switch changed to $v');
|
||||
debugPrint('Switch changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputDateTime'),
|
||||
FlutterFormInputDateTime(
|
||||
inputType: FlutterFormDateTimeType.date,
|
||||
dateFormat: DateFormat('dd/MM/yyyy HH:mm'),
|
||||
inputType: FlutterFormDateTimeType.time,
|
||||
dateFormat: DateFormat('HH:mm'),
|
||||
onChanged: (v) {
|
||||
print('Date changed to $v');
|
||||
debugPrint('Date changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputNumberPicker'),
|
||||
FlutterFormInputNumberPicker(
|
||||
onChanged: (v) {
|
||||
print('Number changed to $v');
|
||||
debugPrint('Number changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputSlider'),
|
||||
FlutterFormInputSlider(
|
||||
onChanged: (v) {
|
||||
print('Slider changed to $v');
|
||||
debugPrint('Slider changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputCarousel'),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
width: 100,
|
||||
height: 150,
|
||||
width: 150,
|
||||
child: FlutterFormInputCarousel(
|
||||
onChanged: (v) {
|
||||
print('Carousel changed to $v');
|
||||
debugPrint('Carousel changed to $v');
|
||||
},
|
||||
items: [
|
||||
Container(
|
||||
|
@ -99,25 +109,32 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
],
|
||||
),
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputPlainText'),
|
||||
FlutterFormInputPlainText(
|
||||
onChanged: (v) {
|
||||
print('Plain text changed to $v');
|
||||
debugPrint('Plain text changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputMultiLine'),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
width: 200,
|
||||
height: 200,
|
||||
width: 300,
|
||||
child: FlutterFormInputMultiLine(
|
||||
onChanged: (v) {
|
||||
print('Multi line changed to $v');
|
||||
debugPrint('Multi line changed to $v');
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(height: 50),
|
||||
const Text('FlutterFormInputPassword'),
|
||||
FlutterFormInputPassword(
|
||||
onChanged: (v) {
|
||||
print('Password changed to $v');
|
||||
debugPrint('Password changed to $v');
|
||||
},
|
||||
),
|
||||
Container(height: 50),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -61,7 +61,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
version: "1.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
|
@ -3,7 +3,7 @@ description: A new Flutter project.
|
|||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
|
@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
sdk: ">=2.18.2 <3.0.0"
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
|
@ -37,7 +37,6 @@ dependencies:
|
|||
flutter_input_library:
|
||||
path: ../
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
|
@ -58,7 +57,6 @@ dev_dependencies:
|
|||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
|
|
30
example/test/widget_test.dart
Normal file
30
example/test/widget_test.dart
Normal file
|
@ -0,0 +1,30 @@
|
|||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:example/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
BIN
flutter_input_library.gif
Normal file
BIN
flutter_input_library.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 MiB |
|
@ -118,8 +118,19 @@ class _DateInputFieldState extends ConsumerState<DateTimeInputField> {
|
|||
break;
|
||||
case FlutterFormDateTimeType.time:
|
||||
userInput = await showTimePicker(
|
||||
context: context, initialTime: TimeOfDay.now())
|
||||
.then((value) => value == null ? '' : value.format(context));
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(alwaysUse24HourFormat: true),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
context: context,
|
||||
initialTime: TimeOfDay.now())
|
||||
.then((value) => value == null
|
||||
? ''
|
||||
: MaterialLocalizations.of(context)
|
||||
.formatTimeOfDay(value, alwaysUse24HourFormat: true));
|
||||
}
|
||||
return userInput;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: flutter_input_library
|
||||
description: A new Flutter package project.
|
||||
version: 0.0.1
|
||||
version: 1.0.0
|
||||
repository: https://github.com/Iconica-Development/flutter_input_library
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
sdk: ">=2.18.2 <3.0.0"
|
||||
flutter: ">=1.17.0"
|
||||
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue