CupertinoPopupSurface Widget
Project Preview
- Interested in seeing the live demo? Click here to explore.
- Want to view the source code? Visit the project on GitHub.
Code Snippet
import 'package:flutter/cupertino.dart';
class CupertinoPopupSurfaceWidget extends StatelessWidget {
const CupertinoPopupSurfaceWidget({super.key});
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: Center(
child: CupertinoButton(
child: const Text("Click Me"),
onPressed: () {
showCupertinoModalPopup(
context: context,
builder: (BuildContext context) {
return CupertinoPopupSurface(
child: Container(
color: CupertinoColors.white,
alignment: Alignment.center,
width: double.infinity,
height: 400,
child: CupertinoButton(
child: const Text('Close'),
onPressed: () {
Navigator.of(context).pop();
},
),
),
);
},
);
},
),
),
);
}
}