null safety
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user