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

@@ -1,7 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:image_picker/image_picker.dart';
import 'local_text.dart';
@@ -18,15 +18,15 @@ modelBottomSheet(BuildContext context, {final OnFile onFile}) {
}
class ImageFile extends StatefulWidget {
final OnFile onFile;
final OnFile? onFile;
const ImageFile({Key key, this.onFile}) : super(key: key);
const ImageFile({Key? key, this.onFile}) : super(key: key);
@override
_ImageFileState createState() => _ImageFileState();
}
class _ImageFileState extends State<ImageFile> {
File selectedFile;
File? selectedFile;
@override
Widget build(BuildContext context) {
return Container(
@@ -44,7 +44,7 @@ class _ImageFileState extends State<ImageFile> {
onTap: () async {
Navigator.pop(context);
selectedFile = await pickImage(ImageSource.gallery);
if (widget.onFile != null) widget.onFile(selectedFile);
if (widget.onFile != null) widget.onFile!(selectedFile!);
}),
new ListTile(
leading: CircleAvatar(
@@ -58,7 +58,7 @@ class _ImageFileState extends State<ImageFile> {
Navigator.pop(context);
selectedFile = await pickImage(ImageSource.camera);
if (widget.onFile != null) widget.onFile(selectedFile);
if (widget.onFile != null) widget.onFile!(selectedFile!);
},
),
new ListTile(
@@ -75,7 +75,7 @@ class _ImageFileState extends State<ImageFile> {
selectedFile = null;
});
if (widget.onFile != null) widget.onFile(selectedFile);
if (widget.onFile != null) widget.onFile!(selectedFile!);
},
),
],