|
| 1 | +import 'package:animate_do/animate_do.dart'; |
| 2 | +import 'package:flutter/material.dart'; |
| 3 | +import 'package:flutter/services.dart'; |
| 4 | +import 'package:pattern_formatter/pattern_formatter.dart'; |
| 5 | + |
| 6 | +class SendMoney extends StatefulWidget { |
| 7 | + final String name; |
| 8 | + final String avatar; |
| 9 | + const SendMoney({ Key? key, required this.name, required this.avatar }) : super(key: key); |
| 10 | + |
| 11 | + @override |
| 12 | + _SendMoneyState createState() => _SendMoneyState(); |
| 13 | +} |
| 14 | + |
| 15 | +class _SendMoneyState extends State<SendMoney> { |
| 16 | + var amount = TextEditingController(text: "0.00"); |
| 17 | + |
| 18 | + @override |
| 19 | + Widget build(BuildContext context) { |
| 20 | + return Scaffold( |
| 21 | + appBar: AppBar( |
| 22 | + backgroundColor: Colors.transparent, |
| 23 | + elevation: 0, |
| 24 | + title: Text('Send Money', style: TextStyle(color: Colors.black),), |
| 25 | + leading: BackButton(color: Colors.black,), |
| 26 | + ), |
| 27 | + body: SingleChildScrollView( |
| 28 | + child: Container( |
| 29 | + width: double.infinity, |
| 30 | + child: Column( |
| 31 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 32 | + children: [ |
| 33 | + SizedBox(height: 50,), |
| 34 | + FadeInDown( |
| 35 | + duration: Duration(milliseconds: 500), |
| 36 | + child: Container( |
| 37 | + width: 130, |
| 38 | + height: 130, |
| 39 | + padding: EdgeInsets.all(8), |
| 40 | + decoration: BoxDecoration( |
| 41 | + color: Colors.pink.shade50, |
| 42 | + borderRadius: BorderRadius.circular(100), |
| 43 | + ), |
| 44 | + child: ClipRRect( |
| 45 | + borderRadius: BorderRadius.circular(50), |
| 46 | + child: Image.asset(widget.avatar)), |
| 47 | + ), |
| 48 | + ), |
| 49 | + SizedBox(height: 50,), |
| 50 | + FadeInRight( |
| 51 | + duration: Duration(milliseconds: 500), |
| 52 | + child: Text("Send Money To", style: TextStyle(color: Colors.grey),)), |
| 53 | + SizedBox(height: 10,), |
| 54 | + FadeInRight( |
| 55 | + duration: Duration(milliseconds: 500), |
| 56 | + child: Text(widget.name, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),)), |
| 57 | + SizedBox(height: 30,), |
| 58 | + FadeInRight( |
| 59 | + duration: Duration(milliseconds: 500), |
| 60 | + child: Padding( |
| 61 | + padding: const EdgeInsets.symmetric(horizontal: 50.0), |
| 62 | + child: TextField( |
| 63 | + controller: amount, |
| 64 | + textAlign: TextAlign.center, |
| 65 | + keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true), |
| 66 | + cursorColor: Colors.black, |
| 67 | + style: TextStyle(color: Colors.black, fontSize: 30, fontWeight: FontWeight.bold), |
| 68 | + onSubmitted: (value) { |
| 69 | + setState(() { |
| 70 | + amount.text = "\$" + value + ".00"; |
| 71 | + }); |
| 72 | + }, |
| 73 | + onTap: () { |
| 74 | + setState(() { |
| 75 | + if (amount.text == "0.00") { |
| 76 | + amount.text = ""; |
| 77 | + } else { |
| 78 | + amount.text = amount.text.replaceAll(RegExp(r'.00'), ''); |
| 79 | + } |
| 80 | + }); |
| 81 | + }, |
| 82 | + inputFormatters: [ |
| 83 | + ThousandsFormatter() |
| 84 | + ], |
| 85 | + decoration: InputDecoration( |
| 86 | + hintText: "Enter Amount", |
| 87 | + hintStyle: TextStyle(color: Colors.grey, fontSize: 20), |
| 88 | + border: OutlineInputBorder( |
| 89 | + borderRadius: BorderRadius.circular(10), |
| 90 | + borderSide: BorderSide.none, |
| 91 | + ), |
| 92 | + focusedBorder: OutlineInputBorder( |
| 93 | + borderRadius: BorderRadius.circular(10), |
| 94 | + borderSide: BorderSide.none, |
| 95 | + ) |
| 96 | + ), |
| 97 | + ), |
| 98 | + ), |
| 99 | + ), |
| 100 | + SizedBox(height: 30,), |
| 101 | + // note textfield |
| 102 | + FadeInRight( |
| 103 | + duration: Duration(milliseconds: 500), |
| 104 | + child: Padding( |
| 105 | + padding: const EdgeInsets.symmetric(horizontal: 50.0), |
| 106 | + child: TextField( |
| 107 | + maxLines: 3, |
| 108 | + keyboardType: TextInputType.text, |
| 109 | + cursorColor: Colors.black, |
| 110 | + style: TextStyle(color: Colors.black, fontSize: 18, fontWeight: FontWeight.w500), |
| 111 | + decoration: InputDecoration( |
| 112 | + contentPadding: EdgeInsets.symmetric(vertical: 20, horizontal: 20), |
| 113 | + hintText: "Note ...", |
| 114 | + hintStyle: TextStyle(color: Colors.grey, fontSize: 15, fontWeight: FontWeight.w500), |
| 115 | + enabledBorder: OutlineInputBorder( |
| 116 | + borderRadius: BorderRadius.circular(10), |
| 117 | + borderSide: BorderSide(color: Colors.grey.shade200, width: 1.5), |
| 118 | + ), |
| 119 | + focusedBorder: OutlineInputBorder( |
| 120 | + borderSide: BorderSide(color: Colors.grey.shade300, width: 1.5), |
| 121 | + ), |
| 122 | + ), |
| 123 | + ), |
| 124 | + ), |
| 125 | + ), |
| 126 | + SizedBox(height: 50,), |
| 127 | + FadeInUp( |
| 128 | + duration: Duration(milliseconds: 500), |
| 129 | + child: Padding( |
| 130 | + padding: const EdgeInsets.symmetric(horizontal: 50.0), |
| 131 | + child: Material( |
| 132 | + elevation: 5, |
| 133 | + borderRadius: BorderRadius.circular(10), |
| 134 | + color: Colors.black, |
| 135 | + child: MaterialButton( |
| 136 | + onPressed: () {}, |
| 137 | + minWidth: double.infinity, |
| 138 | + height: 50, |
| 139 | + child: Text("Send", style: TextStyle(color: Colors.white, fontSize: 16),), |
| 140 | + ), |
| 141 | + ), |
| 142 | + ), |
| 143 | + ), |
| 144 | + ], |
| 145 | + ), |
| 146 | + ), |
| 147 | + ) |
| 148 | + ); |
| 149 | + } |
| 150 | +} |
0 commit comments