咨询建议和投诉表扬新增页面添加默认值

hmxc
小赖 4 years ago
parent 28c9919f23
commit 5aef719471

@ -179,7 +179,10 @@ class _AdvicePageState extends State<AdvicePage> with TickerProviderStateMixin {
), ),
secondChild: BottomButton( secondChild: BottomButton(
onPressed: () async { onPressed: () async {
bool needRefresh = await Get.to(NewAdvicePage(type: widget.type)); bool needRefresh = await Get.to(NewAdvicePage(
type: widget.type,
initType: _tabController.index,
));
if (needRefresh == true) { if (needRefresh == true) {
_refreshController.callRefresh(); _refreshController.callRefresh();
Get.dialog(CupertinoAlertDialog( Get.dialog(CupertinoAlertDialog(

@ -25,14 +25,16 @@ import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
class NewAdvicePage extends StatefulWidget { class NewAdvicePage extends StatefulWidget {
final AdviceType type; final AdviceType type;
NewAdvicePage({Key key, @required this.type}) : super(key: key); final int initType;
NewAdvicePage({Key key, @required this.type, @required this.initType})
: super(key: key);
@override @override
_NewAdvicePageState createState() => _NewAdvicePageState(); _NewAdvicePageState createState() => _NewAdvicePageState();
} }
class _NewAdvicePageState extends State<NewAdvicePage> { class _NewAdvicePageState extends State<NewAdvicePage> {
int _type = 0; int _type;
List<File> _files = []; List<File> _files = [];
TextEditingController _editingController = TextEditingController(); TextEditingController _editingController = TextEditingController();
GlobalKey<FormState> _formKey = GlobalKey<FormState>(); GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -115,6 +117,12 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
} }
} }
@override
void initState() {
super.initState();
_type = widget.initType;
}
@override @override
void dispose() { void dispose() {
_editingController.dispose(); _editingController.dispose();

Loading…
Cancel
Save