null safety

This commit is contained in:
phyothandar
2021-09-10 14:25:37 +06:30
parent 5a313d641e
commit 079c9a135d
31 changed files with 230 additions and 227 deletions

View File

@@ -5,10 +5,10 @@ import 'package:flutter/material.dart';
import 'local_text.dart';
class DialogInput extends StatefulWidget {
final String value;
final String label;
final String? value;
final String? label;
const DialogInput({Key key, this.label, this.value}) : super(key: key);
const DialogInput({Key? key, this.label, this.value}) : super(key: key);
@override
_DialogInputState createState() => _DialogInputState();
}
@@ -24,7 +24,7 @@ class _DialogInputState extends State<DialogInput> {
void initState() {
super.initState();
if (widget.value != null) {
_controller.text = widget.value;
_controller.text = widget.value!;
_focusNode.addListener(() {
if (_focusNode.hasFocus) {
_controller.selection = TextSelection(
@@ -41,7 +41,7 @@ class _DialogInputState extends State<DialogInput> {
child: AlertDialog(
title: LocalText(
context,
widget.label,
widget.label!,
fontSize: 20,
color: primaryColor,
),
@@ -77,7 +77,7 @@ class _DialogInputState extends State<DialogInput> {
fontWeight: FontWeight.bold,
),
onPressed: () async {
if (!_formKey.currentState.validate()) return;
if (!_formKey.currentState!.validate()) return;
_save();
})
],