null safety
This commit is contained in:
@@ -36,7 +36,7 @@ import 'package:fcs/pages/widgets/right_left_page_rout.dart';
|
||||
import 'package:fcs/pages/widgets/task_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
@@ -94,7 +94,7 @@ class _HomePageState extends State<HomePage> {
|
||||
});
|
||||
}
|
||||
|
||||
String notiUserID, notiUserName;
|
||||
late String notiUserID, notiUserName;
|
||||
_showNotiContent(Map<String, dynamic> message) {
|
||||
try {
|
||||
Map<String, dynamic> map = Map<String, dynamic>.from(message["data"]);
|
||||
@@ -291,7 +291,7 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
final staffBtn = TaskButton(
|
||||
"staff.title",
|
||||
icon: MaterialCommunityIcons.worker,
|
||||
icon: MaterialCommunityIcons.account_tie,
|
||||
btnCallback: () => Navigator.of(context).push<void>(CupertinoPageRoute(
|
||||
builder: (context) => StaffList(),
|
||||
)),
|
||||
@@ -350,7 +350,7 @@ class _HomePageState extends State<HomePage> {
|
||||
selectedColor: Colors.white,
|
||||
color: Colors.blue,
|
||||
children: <Widget>[
|
||||
Icon(MaterialCommunityIcons.worker),
|
||||
Icon(MaterialCommunityIcons.account_tie),
|
||||
],
|
||||
onPressed: (i) => this.setState(() {
|
||||
isFcs[0] = !isFcs[0];
|
||||
|
||||
@@ -27,9 +27,9 @@ class _InitialLanguageSelectionPageState
|
||||
languagesList[1]: languageCodesList[1],
|
||||
};
|
||||
|
||||
String selectedLanguage;
|
||||
int selectedIndex;
|
||||
bool _isLoading;
|
||||
late String selectedLanguage;
|
||||
late int selectedIndex;
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -102,8 +102,8 @@ class _InitialLanguageSelectionPageState
|
||||
? BoxDecoration()
|
||||
: BoxDecoration(
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: Colors.grey[300]),
|
||||
bottom: BorderSide(
|
||||
color: Colors.grey.shade300),
|
||||
),
|
||||
),
|
||||
child: ListTile(
|
||||
@@ -134,7 +134,7 @@ class _InitialLanguageSelectionPageState
|
||||
child: Radio(
|
||||
value: key,
|
||||
groupValue: selectedIndex,
|
||||
onChanged: (int i) =>
|
||||
onChanged: (int? i) =>
|
||||
_select(key, language),
|
||||
activeColor: primaryColor,
|
||||
),
|
||||
@@ -178,7 +178,7 @@ class _InitialLanguageSelectionPageState
|
||||
setState(() {
|
||||
selectedIndex = index;
|
||||
selectedLanguage = lang;
|
||||
Translation().onLocaleChanged(Locale(languagesMap[lang]));
|
||||
Translation().onLocaleChanged!(Locale(languagesMap[lang]));
|
||||
Provider.of<LanguageModel>(context, listen: false)
|
||||
.saveLanguage(selectedLanguage);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
bool _loaded = false;
|
||||
bool _isSupport = false;
|
||||
bool _isOnline = true;
|
||||
Timer timer;
|
||||
late Timer timer;
|
||||
|
||||
startTime() async {
|
||||
var _duration = new Duration(milliseconds: 3000);
|
||||
|
||||
@@ -33,7 +33,7 @@ Future showMsgDialog(BuildContext context, String title, String msg) {
|
||||
|
||||
Future<void> showConfirmDialog(
|
||||
BuildContext context, String translationKey, ok(),
|
||||
{List<String> translationVariables}) async {
|
||||
{List<String>? translationVariables}) async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
@@ -42,7 +42,7 @@ Future<void> showConfirmDialog(
|
||||
child: LocalText(
|
||||
context,
|
||||
translationKey,
|
||||
translationVariables: translationVariables,
|
||||
translationVariables: translationVariables!,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
@@ -188,7 +188,7 @@ Widget getStatus(String status) {
|
||||
],
|
||||
)
|
||||
: Text(
|
||||
status ?? "",
|
||||
status,
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 18,
|
||||
@@ -230,10 +230,10 @@ Widget phoneWidget(BuildContext context, String phone) {
|
||||
}
|
||||
|
||||
Widget fcsInput(String label, IconData iconData,
|
||||
{TextEditingController controller,
|
||||
String value,
|
||||
{required TextEditingController controller,
|
||||
required String value,
|
||||
bool autoFocus = false,
|
||||
TextInputType textInputType}) {
|
||||
TextInputType? textInputType}) {
|
||||
return TextFormField(
|
||||
initialValue: value,
|
||||
controller: controller,
|
||||
@@ -257,7 +257,7 @@ Widget fcsInput(String label, IconData iconData,
|
||||
}
|
||||
|
||||
Widget fcsInputReadOnly(String label, IconData iconData,
|
||||
{TextEditingController controller, String value}) {
|
||||
{required TextEditingController controller, required String value}) {
|
||||
return TextFormField(
|
||||
initialValue: value,
|
||||
controller: controller,
|
||||
@@ -279,7 +279,7 @@ Widget fcsInputReadOnly(String label, IconData iconData,
|
||||
}
|
||||
|
||||
Widget fcsDropDown(String label, IconData iconData,
|
||||
{TextEditingController controller}) {
|
||||
{required TextEditingController controller}) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
@@ -308,7 +308,7 @@ Widget _dropDown() {
|
||||
height: 2,
|
||||
color: primaryColor,
|
||||
),
|
||||
onChanged: (String newValue) {},
|
||||
onChanged: (String? newValue) {},
|
||||
items: <String>['Ko Nge', 'Two', 'Free', 'Four']
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
@@ -320,7 +320,7 @@ Widget _dropDown() {
|
||||
}
|
||||
|
||||
Widget fcsButton(BuildContext context, String text,
|
||||
{Function callack, IconData iconData}) {
|
||||
{Function? callack, IconData? iconData}) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
var style = languageModel.isEng
|
||||
@@ -344,7 +344,7 @@ Widget fcsButton(BuildContext context, String text,
|
||||
minWidth: 900.0,
|
||||
height: 100.0,
|
||||
child: FlatButton(
|
||||
onPressed: callack,
|
||||
onPressed: callack == null ? null : () => callack(),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -371,7 +371,7 @@ String getLocalString(BuildContext context, String key) {
|
||||
}
|
||||
|
||||
void showToast(GlobalKey key, String text) {
|
||||
final ScaffoldState scaffold = key.currentState;
|
||||
final ScaffoldState scaffold = key.currentState as ScaffoldState;
|
||||
scaffold.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(text),
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef BtnCallback();
|
||||
class _WelcomePageState extends State<WelcomePage> {
|
||||
final log = Logger('_HomePageWelcomeState');
|
||||
|
||||
String pin;
|
||||
late String pin;
|
||||
List<bool> isSelected = [true, false];
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user