showShakeCrashDetectedBottomSheet function
Implementation
void showShakeCrashDetectedBottomSheet(
BuildContext context, GlobalKey<NavigatorState> navigatorKey) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.white,
builder: (BuildContext context) {
return SingleChildScrollView(
child: Container(
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 40,
width: MediaQuery.of(context).size.width,
color: Colors.black,
child: Center(
child: Text(
"Powered by Quash",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w300,
fontSize: 16,
),
),
),
),
SizedBox(height: 20),
Image.asset(
'assets/quash_black.png',
package: 'flutter_quash_sdk',
width: 77,
fit: BoxFit.fill,
),
SizedBox(height: 20),
Text(
'Quash Automatically detects crashes',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
),
SizedBox(height: 10),
Text(
'Click on Report to manually report bug',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
color: Colors.black54,
),
),
SizedBox(height: 30),
GestureDetector(
onTap: () {
Navigator.pop(context);
// Clear the shake cooldown
lastDetectionTimestamp = 0;
},
child: Container(
width: MediaQuery.of(context).size.width * 0.9,
height: 50,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(10),
),
child: Center(
child: Text(
'CANCEL',
style: TextStyle(fontSize: 16, color: Colors.white),
),
),
),
),
SizedBox(height: 10),
GestureDetector(
onTap: () {
Navigator.pop(context);
navigatorKey.currentState!
.push(
MaterialPageRoute(
builder: (context) => BugReportingScreen()),
)
.then((_) {
ScreenCapture().startCapturing(); // Resume capturing
});
},
child: Container(
width: MediaQuery.of(context).size.width * 0.9,
height: 50,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(10),
),
child: Center(
child: Text(
'REPORT',
style: TextStyle(fontSize: 16, color: Colors.white),
),
),
),
),
SizedBox(height: 40),
],
),
),
);
},
);
}