Flutter全局錯誤頁面處理
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
return getErrorWidget(context, errorDetails);
};
return new MaterialApp(
debugShowCheckedModeBanner: false,
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: SplashPage(),
);
}
Widget getErrorWidget(BuildContext context, FlutterErrorDetails error) {
return Center(
child: Text(
"頁面加載錯誤,請聯繫管理員!",
style: TextStyle(
color: Colors.blue,
fontSize: 14,
),
),
);
}
}