import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:teso/Classes/API%20Clasess/Post.dart'; import 'package:teso/util/SizeConfig.dart'; import 'package:teso/util/consts.dart'; class DeletePost extends StatefulWidget { final Post post; const DeletePost({Key key, this.post}) : super(key: key); @override _DeletePostState createState() => _DeletePostState(); } class _DeletePostState extends State { @override Widget build(BuildContext context) { SizeConfig().init(context); return Scaffold( backgroundColor: Color.fromRGBO(0, 0, 0, 0.5), body: Stack( children: [ Align( alignment: Alignment.bottomCenter, child: Container( margin: EdgeInsets.symmetric( vertical: SizeConfig.blockSizeHorizontal * 5, ), width: MediaQuery.of(context).size.width, height: SizeConfig.blockSizeHorizontal * 52.6, child: Column( children: [ _descriptionBox(context), SizedBox( height: 5, ), _cancelDelete(context), ], ), ), ), ], ), ); } Widget _descriptionBox(BuildContext context) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), ), child: ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(15), topRight: Radius.circular(15), bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15), ), child: Material( child: Container( padding: EdgeInsets.all(10), child: Column( children: [ SizedBox( height: 5, ), Container( margin: EdgeInsets.symmetric( horizontal: SizeConfig.safeBlockHorizontal * 2), padding: EdgeInsets.symmetric( horizontal: SizeConfig.safeBlockHorizontal * 6), alignment: Alignment.center, child: Text( "Once you proceed you cannot undo your actions . " + "Are you sure you would like to delete this post ? ", textAlign: TextAlign.center, style: TextStyle( color: Theme.of(context).colorScheme.secondary == Color(0xFFfd0a35) ? Colors.white24 : tesoBlue), ), ), SizedBox( height: 10, ), Divider(), SizedBox( height: 10, ), InkWell( onTap: () => Navigator.pop(context, true), child: Container( alignment: Alignment.center, width: MediaQuery.of(context).size.width, child: Text( "Delete", style: TextStyle( color: Colors.red, fontSize: SizeConfig.safeBlockHorizontal * 4.0, fontWeight: FontWeight.bold, ), ), ), ), SizedBox( height: 10, ), ], ), ), ), ), ); } Widget _cancelDelete(BuildContext context) { return Container( width: MediaQuery.of(context).size.width, height: SizeConfig.safeBlockVertical * 6.5, decoration: BoxDecoration( borderRadius: BorderRadius.circular(30.0), ), child: ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(15), topRight: Radius.circular(15), bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15), ), child: ColorFiltered( colorFilter: ColorFilter.mode( Colors.white.withOpacity(0.1), BlendMode.lighten), child: Material( child: Container( padding: EdgeInsets.all(10), child: InkWell( onTap: () => Navigator.pop(context, false), child: Text( "Cancel", textAlign: TextAlign.center, style: TextStyle( color: Colors.blueAccent, fontSize: SizeConfig.safeBlockHorizontal * 4.5, fontWeight: FontWeight.bold, ), ), ), ), ), ), ), ); } }