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

@@ -3,15 +3,15 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class LocalRadioButtons<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;
final bool readOnly;
final bool hideUnselected;
const LocalRadioButtons(
{Key key,
{Key? key,
this.callback,
this.iconData,
this.selectedValue,
@@ -26,19 +26,19 @@ class LocalRadioButtons<T> extends StatelessWidget {
}
List<Widget> getChildren() {
return values
return values!
.toList()
.map((e) => SizedBox(
height: 30,
child: InkWell(
onTap: () => callback(e),
onTap: () => callback!(e),
child: Row(children: <Widget>[
Radio<T>(
activeColor: primaryColor,
groupValue: selectedValue,
value: e,
onChanged: (T value) {
callback(value);
onChanged: (T? value) {
callback!(value!);
},
),
Text(e.toString()),
@@ -48,7 +48,7 @@ class LocalRadioButtons<T> extends StatelessWidget {
}
List<Widget> getReadonlyChildren() {
return values
return values!
.toList()
.map((e) => hideUnselected && e == selectedValue
? SizedBox(