Files
flutter_wisetronic/lib/widgets/mobile/mobile_renew_license.dart
peima fce670664b phase3: nullfix.py batch script — bang/late/param-nullable
Automated null-safety fixes driven by dart analyze (no corruption):
- unchecked_use_of_nullable_value: insert '!' on receiver (property/method/[]/op)
- not_initialized field/var: mark 'late'
- missing_default_value_for_parameter: nullable param
Errors: 2374(peak) -> 907
2026-07-25 18:13:01 +08:00

158 lines
4.0 KiB
Dart

import 'dart:async';
import 'package:fluro/fluro.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../generated/l10n.dart';
import '../../routes.dart';
import '../../utils/http_util.dart';
import '../../utils/utils.dart';
class MobileRenewLicense extends StatefulWidget {
final int businessId;
const MobileRenewLicense(this.businessId, {Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return MobileRenewLicenseState();
}
}
class MobileRenewLicenseState extends State<MobileRenewLicense> {
TextEditingController groupNumberController = TextEditingController();
bool canSubmit = false;
@override
Widget build(BuildContext context) {
Column col = Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [],
);
col.children.add(
Container(
padding: EdgeInsets.only(top: 20, left: 16, right: 16, bottom: 10,),
child: Text(
S.of(context).renew_license,
style: TextStyle(
fontSize: 28,
),
),
),
);
col.children.add(
Container(
padding: EdgeInsets.only(top: 0, left: 16, right: 16, bottom: 10),
child: Text(
S.of(context).group_number_can_be_found,
style: TextStyle(
color: Colors.black45,
),
),
)
);
col.children.add(
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 10),
child: Image.asset('assets/images/group_number.png',),
),
);
col.children.add(
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 10),
child: Text(
S.of(context).group_number,
style: TextStyle(
fontSize: 28,
),
),
)
);
col.children.add(
Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 0),
child: TextFormField(
controller: groupNumberController,
decoration: new InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black12,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.blue,
),
),
labelText: S.of(context).group_number,
),
style: TextStyle(
fontSize: 18.0
),
autofocus: true,
validator: (String? value) {
if (value!.trim().isEmpty) {
return S.of(context).please_enter_group_number;
}
return null;
},
onChanged: (string) {
if (string.isNotEmpty) {
canSubmit = true;
} else {
canSubmit = false;
}
setState(() {});
},
),
)
);
col.children.add(Container(
padding: EdgeInsets.only(top: 20, left: 16, right: 16, bottom: 20),
child: ElevatedButton(
child: Text(
S.of(context).submit,
),
onPressed: canSubmit ? () {
_submit();
} : null,
),
));
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: (){
Navigator.of(context).pop();
},
),
title: Text(S.of(context).renew_license),
backgroundColor: Theme.of(context).primaryColor,
),
body: SingleChildScrollView(
child: col,
),
);
}
void _submit() {
HttpUtil.httpPost('v1/get-license-renewal',
(response) {
Routes.router.navigateTo(context, '/renew-minioffice/${response.data['id']}', replace: true);
},
body: {
'group_name': groupNumberController.text.trim(),
},
isFormData: true,
).onError((error, stackTrace) {
Utils.showMessageDialog(context, error);
});
}
}