diff --git a/.packages b/.packages index a03ece3..11bd8f0 100644 --- a/.packages +++ b/.packages @@ -1,23 +1,29 @@ -# Generated by pub on 2019-10-27 16:38:21.039241. -async:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.3.0/lib/ -boolean_selector:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.5/lib/ -charcode:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/ -collection:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/ -cupertino_icons:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/ -flutter:file:///C:/flutter/packages/flutter/lib/ -flutter_test:file:///C:/flutter/packages/flutter_test/lib/ -matcher:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.5/lib/ -meta:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib/ -path:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.4/lib/ -pedantic:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.8.0+1/lib/ -quiver:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.5/lib/ -sky_engine:file:///C:/flutter/bin/cache/pkg/sky_engine/lib/ -source_span:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/ -stack_trace:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ -stream_channel:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/ -string_scanner:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/ -term_glyph:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/ -test_api:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.5/lib/ -typed_data:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ -vector_math:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/ +# This file is deprecated. Tools should instead consume +# `.dart_tools/package_config.json`. +# +# For more info see: https://dart.dev/go/dot-packages-deprecation +# +# Generated by pub on 2021-10-17 07:00:38.629618. +async:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.6.1/lib/ +boolean_selector:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib/ +characters:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib/ +charcode:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/ +clock:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib/ +collection:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib/ +cupertino_icons:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/ +fake_async:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib/ +flutter:file:///C:/src/flutter/packages/flutter/lib/ +flutter_test:file:///C:/src/flutter/packages/flutter_test/lib/ +matcher:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib/ +meta:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/ +path:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib/ +sky_engine:file:///C:/src/flutter/bin/cache/pkg/sky_engine/lib/ +source_span:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/ +stack_trace:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/ +stream_channel:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib/ +string_scanner:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib/ +term_glyph:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib/ +test_api:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.3.0/lib/ +typed_data:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib/ +vector_math:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib/ flutter_app1:lib/ diff --git a/android/local.properties b/android/local.properties index 8e1ca17..6457125 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ -sdk.dir=C:\\Users\\Prasad\\AppData\\Local\\Android\\sdk -flutter.sdk=C:\\flutter +sdk.dir=C:\\Users\\rahul\\AppData\\Local\\Android\\sdk +flutter.sdk=C:\\src\\flutter flutter.buildMode=debug flutter.versionName=1.0.0 flutter.versionCode=1 \ No newline at end of file diff --git a/ios/Runner/GeneratedPluginRegistrant.h b/ios/Runner/GeneratedPluginRegistrant.h index 3b700eb..ed9a5c6 100644 --- a/ios/Runner/GeneratedPluginRegistrant.h +++ b/ios/Runner/GeneratedPluginRegistrant.h @@ -7,8 +7,11 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end +NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ diff --git a/lib/main.dart b/lib/main.dart index dabe4c6..cc8d042 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,190 +1,209 @@ import 'package:flutter/material.dart'; -void main(){ - runApp( - MaterialApp( - debugShowCheckedModeBanner: false, - title: "Simple Interest Calculator App", - home: SIForm(), - theme: ThemeData( - brightness: Brightness.dark, - primaryColor: Colors.indigoAccent, - accentColor: Colors.indigo, - ), - ) - ); + +void main() { + runApp(MaterialApp( + debugShowCheckedModeBanner: false, + title: "Simple Interest Calculator App", + home: SIForm(), + theme: ThemeData( + brightness: Brightness.light, + primaryColor: Colors.green[300], + accentColor: Colors.indigo, + ), + )); } -class SIForm extends StatefulWidget{ + +class SIForm extends StatefulWidget { @override State createState() { - return _SIFormState(); } - } -class _SIFormState extends State{ - var _currencies=['Rupees','Dollars','Ponds']; - final _minimumPadding=5.0; - var _currentItemSlected="Rupees"; - TextEditingController principalController=TextEditingController(); - TextEditingController roiController=TextEditingController(); - TextEditingController termController=TextEditingController(); - var displayResult=""; + +class _SIFormState extends State { + var _currencies = ['Rupees', 'Dollars', 'Ponds']; + final _minimumPadding = 5.0; + var _currentItemSlected = "Rupees"; + TextEditingController principalController = TextEditingController(); + TextEditingController roiController = TextEditingController(); + TextEditingController termController = TextEditingController(); + var displayResult = ""; @override Widget build(BuildContext context) { - TextStyle textStyle=Theme.of(context).textTheme.title; + TextStyle textStyle = Theme.of(context).textTheme.title; return Scaffold( //resizeToAvoidBottomPadding: false, appBar: AppBar( title: Text("Simple interest Calculator"), ), - body:Container( + body: Container( child: ListView( children: [ getImageAsset(), Padding( - padding: EdgeInsets.only(top: _minimumPadding,bottom: _minimumPadding), - child:TextField( + padding: EdgeInsets.only( + top: _minimumPadding + 3, + bottom: _minimumPadding + 3, + right: 20, + left: 20), + child: TextField( keyboardType: TextInputType.number, style: textStyle, controller: principalController, decoration: InputDecoration( - labelText: "Principal", + labelText: "Principal(P)", hintText: "Enter principal eg:1234", labelStyle: textStyle, border: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.0) - ), - - + borderRadius: BorderRadius.circular(5.0)), ), )), Padding( - padding: EdgeInsets.only(top: _minimumPadding,bottom: _minimumPadding), - child:TextField( + padding: EdgeInsets.only( + top: _minimumPadding + 3, + bottom: _minimumPadding + 3, + right: 20, + left: 20), + child: TextField( keyboardType: TextInputType.number, style: textStyle, controller: roiController, decoration: InputDecoration( - labelText: "Rate of Interest", - hintText: "IN percentage", + labelText: "Rate of Interest(R)", + hintText: "in % (percentage)", + hintStyle: TextStyle(fontSize: 16), labelStyle: textStyle, border: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.0) - ), - - + borderRadius: BorderRadius.circular(5.0)), ), )), Padding( - padding: EdgeInsets.only(top: _minimumPadding,bottom: _minimumPadding), - child:Row( - children: [ - Expanded( - child:TextField( - keyboardType: TextInputType.number, - style: textStyle, - controller: termController, - decoration: InputDecoration( - labelText: "Terms", - hintText: "Time in Year", - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(5.0) + padding: EdgeInsets.only( + top: _minimumPadding + 3, + bottom: _minimumPadding + 3, + right: 20, + left: 20), + child: Row( + children: [ + Expanded( + child: TextField( + keyboardType: TextInputType.number, + style: textStyle, + controller: termController, + decoration: InputDecoration( + labelText: "Terms", + hintText: " no. of years", + hintStyle: TextStyle(fontSize: 16), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(5.0)), + ), + )), + Container( + width: _minimumPadding * 5, ), - - - ), + Expanded( + child: DropdownButton( + items: _currencies.map((String value) { + return DropdownMenuItem( + value: value, + child: Text( + value, + style: textStyle, + ), + ); + }).toList(), + value: _currentItemSlected, + onChanged: (String newValueSelected) { + _onDropDownItemSelected(newValueSelected); + }, + )) + ], )), - Container(width: _minimumPadding*5,), - Expanded( - child:DropdownButton( - items:_currencies.map((String value){ - return DropdownMenuItem( - value: value, - child: Text(value,style: textStyle,), - - ); - } - ).toList(), - value: _currentItemSlected, - onChanged: (String newValueSelected){ - _onDropDownItemSelected(newValueSelected); - - }, - )) - - ], - )), Padding( - padding: EdgeInsets.only(top: _minimumPadding,bottom: _minimumPadding), - child:Row( - children: [ - - Expanded( - child: RaisedButton( - color: Theme.of(context).accentColor, + padding: EdgeInsets.only( + top: _minimumPadding + 3, + bottom: _minimumPadding + 3, + right: 20, + left: 20), + child: Row( + children: [ + Expanded( + child: RaisedButton( + color: Colors.green[300], textColor: Theme.of(context).primaryColorDark, - child: Text("Calculate",style: textStyle,), - onPressed: (){ + child: Text( + "Calculate", + style: textStyle, + ), + onPressed: () { setState(() { - this.displayResult=calculateTotalReturns(); + this.displayResult = calculateTotalReturns(); }); - - - }, )), - Expanded( - child: RaisedButton( + Expanded( + child: RaisedButton( color: Theme.of(context).primaryColorDark, - textColor: Theme.of(context).accentColor, - child: Text("Reset"), - onPressed: (){ + textColor: Colors.black, + child: Text( + "Reset", + style: TextStyle(fontSize: 19), + ), + onPressed: () { setState(() { _reset(); }); - }, )), - ], - )), + ], + )), Padding( padding: EdgeInsets.all(_minimumPadding), - child:Text(this.displayResult,style: textStyle,), + child: Text( + this.displayResult, + style: textStyle, + ), ) - - - ], ), ), - ); } - Widget getImageAsset(){ - AssetImage assetImage=AssetImage("images/money.png"); - Image image=Image(image: assetImage,width: 125.0,height: 125.0,); - return Container(child: image, margin: EdgeInsets.all(_minimumPadding*10),); + + Widget getImageAsset() { + AssetImage assetImage = AssetImage("images/money.png"); + Image image = Image( + image: assetImage, + width: 125.0, + height: 125.0, + ); + return Container( + child: image, + margin: EdgeInsets.all(_minimumPadding * 10), + ); } - void _onDropDownItemSelected(String newValueSelected){ + + void _onDropDownItemSelected(String newValueSelected) { setState(() { - this._currentItemSlected=newValueSelected; + this._currentItemSlected = newValueSelected; }); } - String calculateTotalReturns(){ - double principal=double.parse(principalController.text); - double roi=double.parse(roiController.text); - double term=double.parse(termController.text); - double totalAmountPayable=principal+(principal*roi*term)/100; - String result="After $term years,your investment will be worth $totalAmountPayable $_currentItemSlected"; + + String calculateTotalReturns() { + double principal = double.parse(principalController.text); + double roi = double.parse(roiController.text); + double term = double.parse(termController.text); + double totalAmountPayable = principal + (principal * roi * term) / 100; + String result = ''' After $term years, + Total amount: $totalAmountPayable'''; return result; } - void _reset(){ - principalController.text=""; - roiController.text=""; - termController.text=""; - displayResult=""; - _currentItemSlected=_currencies[0]; - } - -} \ No newline at end of file + void _reset() { + principalController.text = ""; + roiController.text = ""; + termController.text = ""; + displayResult = ""; + _currentItemSlected = _currencies[0]; + } +} diff --git a/pubspec.lock b/pubspec.lock index fbdb266..a7a3dad 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,28 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -36,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -52,35 +73,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -92,55 +99,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0"