My customized button widget isn't functioning correctly in preview, test, or run modes. When you click on a certain place, it works. To go to the page, I have added a custom action to the button widget.
import '/backend/backend.dart';
import '/backend/supabase/supabase.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
import 'package:flutter_cashfree_pg_sdk/api/cfpaymentgateway/cfpaymentgatewayservice.dart';
void main() {
runApp(const PayButton());
}
class PayButton extends StatefulWidget {
final double? height;
final double? width;
const PayButton({super.key, this.height, this.width});
@override
State<PayButton> createState() => _PayButtonState();
}
class _PayButtonState extends State<PayButton> {
@override
void initState() {
super.initState();
CFPaymentGatewayService();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// SizedBox ensures that ElevatedButton expands to full width.
SizedBox(
width: double.infinity,
height: 40,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor: const Color.fromARGB(255, 241, 244, 248),
backgroundColor: const Color.fromARGB(255, 78, 180, 217),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
onPressed: () {
// Entire button area will be clickable.
print("Proceed to Pay pressed");
},
child: const Text(
'Proceed to Pay',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
),
),
),
],
),
),
),
);
}
}