forked from firka/student-legacy
started exception screen
This commit is contained in:
parent
8c46b941ae
commit
73d596c645
@ -14,16 +14,12 @@ class ErrorReportScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.red,
|
||||
backgroundColor: Color(0xFFE3EBFB),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: BackButton(),
|
||||
),
|
||||
const Spacer(),
|
||||
const Icon(
|
||||
FeatherIcons.alertTriangle,
|
||||
@ -58,13 +54,25 @@ class ErrorReportScreen extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
color: Colors.black.withOpacity(.2)),
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
color: const Color(0xFFF7F9FC),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 7,
|
||||
offset:
|
||||
const Offset(0, 3), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Text(
|
||||
details.exceptionAsString(),
|
||||
style: const TextStyle(fontFamily: 'SpaceMono'),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'GeistMono',
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -85,7 +93,8 @@ class ErrorReportScreen extends StatelessWidget {
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
const EdgeInsets.symmetric(vertical: 14.0)),
|
||||
backgroundColor: MaterialStateProperty.all(Colors.white),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(const Color(0xFF0E275A)),
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
@ -94,14 +103,42 @@ class ErrorReportScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
"submit".i18n,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 17.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
color: Color(0xFFF7F9FC),
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: 'Montserrat'),
|
||||
),
|
||||
onPressed: () => reportProblem(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
const EdgeInsets.symmetric(vertical: 14.0)),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(Color(0xFFF3F7FE)),
|
||||
foregroundColor:
|
||||
MaterialStateProperty.all(const Color(0xFFC7D3EB)),
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0)),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"goback".i18n,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF011234),
|
||||
fontSize: 18.0,
|
||||
fontFamily: 'Montserrat',
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
onPressed: () => Navigator.maybePop(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32.0)
|
||||
],
|
||||
),
|
||||
|
@ -7,6 +7,7 @@ extension SettingsLocalization on String {
|
||||
"uhoh": "Uh Oh!",
|
||||
"description": "An error occurred!",
|
||||
"submit": "Submit",
|
||||
"goback": "Go back",
|
||||
"details": "Details",
|
||||
"error": "Error",
|
||||
"os": "Operating System",
|
||||
@ -17,7 +18,8 @@ extension SettingsLocalization on String {
|
||||
"hu_hu": {
|
||||
"uhoh": "Ajajj!",
|
||||
"description": "Hiba történt!",
|
||||
"submit": "Probléma Jelentése",
|
||||
"submit": "Hiba jelentése",
|
||||
"goback": "Vissza",
|
||||
"details": "Részletek",
|
||||
"error": "Hiba",
|
||||
"os": "Operációs Rendszer",
|
||||
@ -29,6 +31,7 @@ extension SettingsLocalization on String {
|
||||
"uhoh": "Uh Oh!",
|
||||
"description": "Ein Fehler ist aufgetreten!",
|
||||
"submit": "Abschicken",
|
||||
"goback": "Zurück",
|
||||
"details": "Details",
|
||||
"error": "Fehler",
|
||||
"os": "Betriebssystem",
|
||||
|
@ -59,7 +59,8 @@ import 'package:refilc_mobile_ui/screens/settings/user/nickname.dart';
|
||||
import 'package:refilc_mobile_ui/screens/settings/user/profile_pic.dart';
|
||||
// import 'package:refilc_plus/ui/mobile/settings/modify_teacher_names.dart';
|
||||
// import 'package:refilc_plus/ui/mobile/settings/welcome_message.dart';
|
||||
|
||||
import 'package:refilc_mobile_ui/screens/error_screen.dart';
|
||||
import 'package:refilc_mobile_ui/screens/error_report_screen.dart';
|
||||
import 'submenu/general_screen.dart';
|
||||
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
@ -198,6 +199,17 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
vsync: this, duration: const Duration(milliseconds: 200));
|
||||
}
|
||||
|
||||
void showErrorScreen(BuildContext context, FlutterErrorDetails details) {
|
||||
Navigator.of(context, rootNavigator: true)
|
||||
.push(MaterialPageRoute(builder: (context) {
|
||||
if (kReleaseMode) {
|
||||
return ErrorReportScreen(details);
|
||||
} else {
|
||||
return ErrorReportScreen(details);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
user = Provider.of<UserProvider>(context);
|
||||
@ -993,6 +1005,19 @@ class SettingsScreenState extends State<SettingsScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
// Generate fake error details
|
||||
FlutterErrorDetails fakeErrorDetails = FlutterErrorDetails(
|
||||
exception: Exception('fasz'),
|
||||
stack: StackTrace.current,
|
||||
library: 'MyApp',
|
||||
context: ErrorDescription('a kurva a-'),
|
||||
);
|
||||
showErrorScreen(context, fakeErrorDetails);
|
||||
},
|
||||
child: Text('hiba_tesztelese'),
|
||||
),
|
||||
|
||||
// developer options
|
||||
if (settings.developerMode)
|
||||
|
Loading…
x
Reference in New Issue
Block a user