Fixing label & hint style issues
Moving to a more generic architecture Updating the analysis_options.yaml file
This commit is contained in:
parent
ddcb665d2f
commit
13eaa0df3a
10 changed files with 431 additions and 427 deletions
|
@ -1,33 +1,38 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:date_field/date_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
inputDecorationTheme:
|
||||
const InputDecorationTheme(border: OutlineInputBorder()),
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: MyHomePage(),
|
||||
home: const MyHomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
DateTime selectedDate;
|
||||
DateTime? selectedDate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -36,7 +41,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const FlutterLogo(size: 100),
|
||||
const SizedBox(height: 20),
|
||||
const Text('DateField package showcase'),
|
||||
|
@ -59,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
),
|
||||
Form(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
DateTimeFormField(
|
||||
decoration: const InputDecoration(
|
||||
hintStyle: TextStyle(color: Colors.black45),
|
||||
|
@ -69,7 +74,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
labelText: 'My Super Date Time Field',
|
||||
),
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
validator: (e) =>
|
||||
validator: (DateTime? e) =>
|
||||
(e?.day ?? 0) == 1 ? 'Please not the first day' : null,
|
||||
onDateSelected: (DateTime value) {
|
||||
print(value);
|
||||
|
@ -86,8 +91,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
),
|
||||
mode: DateTimeFieldPickerMode.time,
|
||||
autovalidateMode: AutovalidateMode.always,
|
||||
validator: (e) =>
|
||||
(e?.day ?? 0) == 1 ? 'Please not the first day' : null,
|
||||
validator: (DateTime? e) {
|
||||
return (e?.day ?? 0) == 1
|
||||
? 'Please not the first day'
|
||||
: null;
|
||||
},
|
||||
onDateSelected: (DateTime value) {
|
||||
print(value);
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -21,7 +21,7 @@ dependencies:
|
|||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
cupertino_icons: ^1.0.3
|
||||
|
||||
|
||||
flutter:
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility that Flutter provides. 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(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);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue