Updated README, added GIF, updated example, added Github Actions and Depandabot

This commit is contained in:
Thomas Klein Langenhorst 2022-12-20 13:46:35 +01:00 committed by joonsv
parent 13067633de
commit 5afec94105
13 changed files with 155 additions and 48 deletions

10
.github/dependabot.yaml vendored Normal file
View 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
View 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

View file

@ -1,3 +1,7 @@
## 0.0.1 ## 0.0.1
* Initial release, retrieved inputs from flutter_form * 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

View file

@ -1,14 +1,18 @@
[![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart) [![pub package](https://img.shields.io/pub/v/flutter_input_library.svg)](https://github.com/Iconica-Development) [![Build status](https://img.shields.io/github/workflow/status/Iconica-Development/flutter_input_library/CI)](https://github.com/Iconica-Development/flutter_input_library/actions/new) [![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](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.
![Input GIF](flutter_input_library.gif)
## Setup ## 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 ## 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 ## Issues

View file

@ -4,7 +4,7 @@
# This file should be version controlled. # This file should be version controlled.
version: version:
revision: eb6d86ee27deecba4a83536aa20f366a6044895c revision: 135454af32477f815a7525073027a3ff9eff1bfd
channel: stable channel: stable
project_type: app project_type: app
@ -13,26 +13,11 @@ project_type: app
migration: migration:
platforms: platforms:
- platform: root - platform: root
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
- platform: android
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: ios - platform: ios
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
- 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
# User provided section # User provided section

16
example/README.md Normal file
View 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.

View file

@ -50,35 +50,45 @@ class _MyHomePageState extends State<MyHomePage> {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
Container(height: 10),
const Text('FlutterFormInputSwitch'),
FlutterFormInputSwitch( FlutterFormInputSwitch(
initialValue: true, initialValue: true,
onChanged: (v) { onChanged: (v) {
print('Switch changed to $v'); debugPrint('Switch changed to $v');
}, },
), ),
Container(height: 50),
const Text('FlutterFormInputDateTime'),
FlutterFormInputDateTime( FlutterFormInputDateTime(
inputType: FlutterFormDateTimeType.date, inputType: FlutterFormDateTimeType.time,
dateFormat: DateFormat('dd/MM/yyyy HH:mm'), dateFormat: DateFormat('HH:mm'),
onChanged: (v) { onChanged: (v) {
print('Date changed to $v'); debugPrint('Date changed to $v');
}, },
), ),
Container(height: 50),
const Text('FlutterFormInputNumberPicker'),
FlutterFormInputNumberPicker( FlutterFormInputNumberPicker(
onChanged: (v) { onChanged: (v) {
print('Number changed to $v'); debugPrint('Number changed to $v');
}, },
), ),
Container(height: 50),
const Text('FlutterFormInputSlider'),
FlutterFormInputSlider( FlutterFormInputSlider(
onChanged: (v) { onChanged: (v) {
print('Slider changed to $v'); debugPrint('Slider changed to $v');
}, },
), ),
Container(height: 50),
const Text('FlutterFormInputCarousel'),
SizedBox( SizedBox(
height: 100, height: 150,
width: 100, width: 150,
child: FlutterFormInputCarousel( child: FlutterFormInputCarousel(
onChanged: (v) { onChanged: (v) {
print('Carousel changed to $v'); debugPrint('Carousel changed to $v');
}, },
items: [ items: [
Container( Container(
@ -99,25 +109,32 @@ class _MyHomePageState extends State<MyHomePage> {
], ],
), ),
), ),
Container(height: 50),
const Text('FlutterFormInputPlainText'),
FlutterFormInputPlainText( FlutterFormInputPlainText(
onChanged: (v) { onChanged: (v) {
print('Plain text changed to $v'); debugPrint('Plain text changed to $v');
}, },
), ),
Container(height: 50),
const Text('FlutterFormInputMultiLine'),
SizedBox( SizedBox(
height: 50, height: 200,
width: 200, width: 300,
child: FlutterFormInputMultiLine( child: FlutterFormInputMultiLine(
onChanged: (v) { onChanged: (v) {
print('Multi line changed to $v'); debugPrint('Multi line changed to $v');
}, },
), ),
), ),
Container(height: 50),
const Text('FlutterFormInputPassword'),
FlutterFormInputPassword( FlutterFormInputPassword(
onChanged: (v) { onChanged: (v) {
print('Password changed to $v'); debugPrint('Password changed to $v');
}, },
), ),
Container(height: 50),
], ],
), ),
), ),

View file

@ -61,7 +61,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "0.0.1" version: "1.0.0"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:

View file

@ -3,7 +3,7 @@ description: A new Flutter project.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # 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. # The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43 # 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 version: 1.0.0+1
environment: 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. # Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions # To automatically upgrade your package dependencies to the latest versions
@ -34,10 +34,9 @@ dependencies:
intl: any intl: any
flutter_input_library: flutter_input_library:
path: ../ path: ../
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
@ -58,7 +57,6 @@ dev_dependencies:
# The following section is specific to Flutter packages. # The following section is specific to Flutter packages.
flutter: flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

View file

@ -118,8 +118,19 @@ class _DateInputFieldState extends ConsumerState<DateTimeInputField> {
break; break;
case FlutterFormDateTimeType.time: case FlutterFormDateTimeType.time:
userInput = await showTimePicker( userInput = await showTimePicker(
context: context, initialTime: TimeOfDay.now()) builder: (BuildContext context, Widget? child) {
.then((value) => value == null ? '' : value.format(context)); 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; return userInput;
} }

View file

@ -1,10 +1,10 @@
name: flutter_input_library name: flutter_input_library
description: A new Flutter package project. description: A new Flutter package project.
version: 0.0.1 version: 1.0.0
repository: https://github.com/Iconica-Development/flutter_input_library repository: https://github.com/Iconica-Development/flutter_input_library
environment: environment:
sdk: '>=2.18.2 <3.0.0' sdk: ">=2.18.2 <3.0.0"
flutter: ">=1.17.0" flutter: ">=1.17.0"
dependencies: dependencies: