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

@@ -6,13 +6,13 @@ import 'package:flutter/material.dart';
import 'local_text.dart';
class DiscountDropdown<T> extends StatelessWidget {
final Function(T) callback;
final IconData iconData;
final T selectedValue;
final List<T> values;
final Function(T)? callback;
final IconData? iconData;
final T? selectedValue;
final List<T>? values;
const DiscountDropdown(
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
{Key? key, this.callback, this.iconData, this.selectedValue, this.values})
: super(key: key);
@override
@@ -46,11 +46,11 @@ class DiscountDropdown<T> extends StatelessWidget {
height: 1,
color: primaryColor,
),
onChanged: (T newValue) {
callback(newValue);
onChanged: (T? newValue) {
callback!(newValue!);
},
isExpanded: true,
items: values.map<DropdownMenuItem<T>>((T value) {
items: values!.map<DropdownMenuItem<T>>((T value) {
return DropdownMenuItem<T>(
value: value,
child: Text(value == null ? "" : (value as Discount).code,