【发布时间】:2020-08-28 07:47:37
【问题描述】:
通过设备后退按钮导航时页面跳过。
import 'package:flutter/material.dart';
import 'package:modal_progress_hud/modal_progress_hud.dart';
class Attendance extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return AttendanceCalendar();
}
}
class AttendanceCalendar extends State<Attendance> {
bool isAsync = false;
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onBackButtonPressed,
child: ModalProgressHUD(
inAsyncCall: isAsync,
child: Scaffold(
appBar: AppBar(
title: Text("Attendance");
),
body: Container(),
),
),
);
}
void _onBackButtonPressed() {
Navigator.pop(context);
}
}
【问题讨论】:
标签: flutter flutter-layout flutter-navigation