Merge remote-tracking branch 'tzw/master'
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class FlavorBanner extends StatelessWidget {
|
||||
final Widget child;
|
||||
FlavorBanner({@required this.child});
|
||||
FlavorBanner({required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:barcode_scan/barcode_scan.dart';
|
||||
import 'package:barcode_scan2/platform_wrapper.dart';
|
||||
|
||||
Future<String> scanBarcode() async {
|
||||
Future<String?> scanBarcode() async {
|
||||
try {
|
||||
String barcode = await BarcodeScanner.scan();
|
||||
if (barcode == null) return null;
|
||||
var scanResult = await BarcodeScanner.scan();
|
||||
String barcode = scanResult.rawContent;
|
||||
|
||||
String gs = String.fromCharCode(29);
|
||||
if (barcode.contains(gs)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ class BottomWidgets extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var pkgInfo = Provider.of<MainModel>(context).packageInfo;
|
||||
final versionBox = Text(
|
||||
"v${pkgInfo.version}+${pkgInfo.buildNumber}",
|
||||
"v${pkgInfo?.version}+${pkgInfo?.buildNumber}",
|
||||
style: TextStyle(color: Colors.white30),
|
||||
);
|
||||
return Column(
|
||||
|
||||
@@ -8,17 +8,26 @@ class DisplayImageSource {
|
||||
File? file;
|
||||
DisplayImageSource({this.url, this.file});
|
||||
|
||||
ImageProvider? get imageProvider =>
|
||||
file == null ? CachedNetworkImageProvider(url!) : FileImage(file!);
|
||||
ImageProvider get imageProvider {
|
||||
if (file == null) {
|
||||
return CachedNetworkImageProvider(url!);
|
||||
} else {
|
||||
return FileImage(file!);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(other) {
|
||||
if (identical(this, other)) {
|
||||
if (identical(this, other) && other is DisplayImageSource) {
|
||||
return true;
|
||||
}
|
||||
return (other.file == this.file &&
|
||||
|
||||
return (other is DisplayImageSource &&
|
||||
other.file == this.file &&
|
||||
(other.file != null || this.file != null)) ||
|
||||
(other.url == this.url && (other.url != null || this.url != null));
|
||||
(other is DisplayImageSource &&
|
||||
other.url == this.url &&
|
||||
(other.url != null || this.url != null));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'local_text.dart';
|
||||
|
||||
typedef OnFile = void Function(File);
|
||||
|
||||
modelBottomSheet(BuildContext context, {final OnFile onFile}) {
|
||||
modelBottomSheet(BuildContext context, {final OnFile? onFile}) {
|
||||
showModalBottomSheet(
|
||||
elevation: 10,
|
||||
backgroundColor: Colors.white,
|
||||
@@ -84,7 +84,7 @@ class _ImageFileState extends State<ImageFile> {
|
||||
}
|
||||
|
||||
pickImage(ImageSource source) async {
|
||||
var tempImage = await ImagePicker.pickImage(source: source);
|
||||
var tempImage = await ImagePicker().pickImage(source: source);
|
||||
return tempImage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
@@ -7,19 +8,19 @@ import 'package:image_picker/image_picker.dart';
|
||||
|
||||
import 'show_img.dart';
|
||||
|
||||
typedef OnFile = void Function(File);
|
||||
typedef OnFile = void Function(File?);
|
||||
|
||||
class LocalImagePicker extends StatefulWidget {
|
||||
final Color color;
|
||||
final Color? color;
|
||||
final String title;
|
||||
final OnFile onFile;
|
||||
final OnFile? onFile;
|
||||
final bool enabled;
|
||||
final String initialImgUrl;
|
||||
final String? initialImgUrl;
|
||||
final ImageSource imageSource;
|
||||
|
||||
const LocalImagePicker(
|
||||
{Key key,
|
||||
this.title,
|
||||
{Key? key,
|
||||
required this.title,
|
||||
this.onFile,
|
||||
this.enabled = true,
|
||||
this.initialImgUrl,
|
||||
@@ -31,8 +32,8 @@ class LocalImagePicker extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LocalImagePickerState extends State<LocalImagePicker> {
|
||||
String url;
|
||||
File file;
|
||||
String? url;
|
||||
File? file;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -56,16 +57,16 @@ class _LocalImagePickerState extends State<LocalImagePicker> {
|
||||
await _dialog(
|
||||
context, () => camera = true, () => gallery = true);
|
||||
if (camera || gallery) {
|
||||
var selectedFile = await ImagePicker.pickImage(
|
||||
var selectedFile = await ImagePicker().pickImage(
|
||||
source: camera ? ImageSource.camera : ImageSource.gallery,
|
||||
imageQuality: 80,
|
||||
maxWidth: 1000);
|
||||
if (selectedFile != null) {
|
||||
setState(() {
|
||||
this.file = selectedFile;
|
||||
this.file = File(selectedFile.path);
|
||||
});
|
||||
if (widget.onFile != null) {
|
||||
widget.onFile(selectedFile);
|
||||
widget.onFile!(File(selectedFile.path));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,7 @@ class _LocalImagePickerState extends State<LocalImagePicker> {
|
||||
this.file = null;
|
||||
this.url = null;
|
||||
if (widget.onFile != null) {
|
||||
widget.onFile(null);
|
||||
widget.onFile!(null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -144,7 +144,8 @@ class _LengthPickerDialogState extends State<LengthPickerDialog> {
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade400, width: 1.0),
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey.shade400, width: 1.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -196,7 +197,8 @@ class _LengthPickerDialogState extends State<LengthPickerDialog> {
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey.shade400, width: 1.0),
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey.shade400, width: 1.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -273,7 +275,7 @@ class _LengthPickerDialogState extends State<LengthPickerDialog> {
|
||||
min: 0,
|
||||
max: MAX_FEET,
|
||||
divisions: 100,
|
||||
label: (_valueFeet ?? 0).round().toString(),
|
||||
label: _valueFeet.round().toString(),
|
||||
onChanged: (double v) {
|
||||
_updateFeet(v);
|
||||
},
|
||||
@@ -301,7 +303,7 @@ class _LengthPickerDialogState extends State<LengthPickerDialog> {
|
||||
min: 0,
|
||||
max: widget.displayFeet! ? 11 : MAX_INC,
|
||||
divisions: 100,
|
||||
label: (_valueInc ?? 0).round().toString(),
|
||||
label: _valueInc.round().toString(),
|
||||
onChanged: (double v) {
|
||||
_updateInc(v);
|
||||
},
|
||||
|
||||
@@ -5,12 +5,12 @@ import 'display_image_source.dart';
|
||||
|
||||
class MultiImgController {
|
||||
List<String> imageUrls = [];
|
||||
List<File> imageFiles = [];
|
||||
List<File?> imageFiles = [];
|
||||
List<DisplayImageSource> addedFiles = [];
|
||||
List<DisplayImageSource> removedFiles = [];
|
||||
|
||||
List<DisplayImageSource> fileContainers = [];
|
||||
CallBack callback;
|
||||
CallBack? callback;
|
||||
MultiImgController() {
|
||||
fileContainers = [];
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class MultiImgController {
|
||||
fileContainers.add(DisplayImageSource(url: e));
|
||||
});
|
||||
if (callback != null) {
|
||||
callback();
|
||||
callback!();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class MultiImgController {
|
||||
fileContainers.add(DisplayImageSource(file: e));
|
||||
});
|
||||
if (callback != null) {
|
||||
callback();
|
||||
callback!();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class MultiImgController {
|
||||
// if (fileContainers.contains(fileContainer)) return;
|
||||
addedFiles.add(fileContainer);
|
||||
if (callback != null) {
|
||||
callback();
|
||||
callback!();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class MultiImgController {
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback();
|
||||
callback!();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user