Advertisement
gakuta

Untitled

Oct 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.97 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MyApp());
  4.  
  5. class MyApp extends StatelessWidget {
  6.   @override
  7.   Widget build(BuildContext context) {
  8.     return MaterialApp(
  9.       debugShowCheckedModeBanner: false,
  10.       title: "EMI Calculator",
  11.       theme: ThemeData(
  12.         primarySwatch: Colors.teal,
  13.       ),
  14.       home: Calc(),
  15.     );
  16.   }
  17. }
  18.  
  19. class Calc extends StatefulWidget {
  20.   @override
  21.   CalcState createState() => CalcState();
  22. }
  23.  
  24. class CalcState extends State<Calc> {
  25.   @override
  26.   Widget build(BuildContext context) {
  27.     return Scaffold(
  28.       appBar: AppBar(
  29.         title: Text("My EMI Calculator"),
  30.         elevation: 0.0,
  31.       ),
  32.       body: Center(
  33.         child: Container(
  34.           child: Column(
  35.             children: <Widget>[
  36.               Container(
  37.                 padding: EdgeInsets.all(10.0),
  38.                 child: TextField(
  39.                   keyboardType: TextInputType.number,
  40.                   decoration: InputDecoration(
  41.                     labelText: "Enter Principal Amount",
  42.                   ),
  43.                 ),
  44.               ),
  45.               Container(
  46.                 padding: EdgeInsets.all(10.0),
  47.                 child: TextField(
  48.                   keyboardType: TextInputType.number,
  49.                   decoration: InputDecoration(
  50.                     labelText: "Interest Rate (%)",
  51.                   ),
  52.                 ),
  53.               ),
  54.               Container(
  55.                   padding: EdgeInsets.all(10.0),
  56.                   child: Row(
  57.                     children: <Widget>[
  58.                       Flexible(
  59.                         flex: 4,
  60.                         fit: FlexFit.tight,
  61.                         child: TextField(
  62.                           decoration: InputDecoration(labelText: "Duration"),
  63.                         ),
  64.                       ),
  65.                       Flexible(
  66.                         flex: 1,
  67.                         child: Column(
  68.                           children: <Widget>[
  69.                             Text("Year(s)"),
  70.                             Switch(
  71.                               value: false,
  72.                             )
  73.                           ],
  74.                         ),
  75.                       )
  76.                     ],
  77.                   )),
  78.               Flexible(
  79.                 child: RaisedButton(
  80.                   child: Text("Calculate"),
  81.                   textColor: Colors.white,
  82.                   color: Colors.teal[700],
  83.                   onPressed: () => print("2222.."),
  84.                   elevation: 5.0,
  85.                 ),
  86.               ),
  87.               Container(
  88.                 child: Column(
  89.                   children: <Widget>[
  90.                     Text("Your monthly EMI is:"),
  91.                     Container(
  92.                       child: Text("results here..."),
  93.                     )
  94.                   ],
  95.                 ),
  96.               ),
  97.             ],
  98.           ),
  99.         ),
  100.       ),
  101.     );
  102.   }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement