Skip to content

Commit

Permalink
Count Result and reset button add, App name change
Browse files Browse the repository at this point in the history
  • Loading branch information
MdAshrafUllah committed Jan 22, 2023
1 parent a74ae3c commit 46ca76b
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 54 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rentapp">
<application
android:label="rentapp"
android:label="Rent Count"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon">
<activity
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>rentapp</string>
<string>Rent Count</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
248 changes: 198 additions & 50 deletions lib/fuelcount.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:searchfield/searchfield.dart';

class fuelcount extends StatefulWidget {
Expand All @@ -12,6 +13,9 @@ class _fuelcountState extends State<fuelcount> {
_fuelcountState() {
_selectedval = _vehicletypes[0];
}
final TextEditingController _searchfildcontroller = TextEditingController();
final TextEditingController _searchfildcontroller2 = TextEditingController();
final TextEditingController _rentcount = TextEditingController();

final _vehicletypes = [
"Diesel Bus",
Expand All @@ -22,6 +26,21 @@ class _fuelcountState extends State<fuelcount> {
];
String? _selectedval = "";

final _rent = [
"5 TK",
"6 TK",
"7 TK",
"8 TK",
"10 TK",
"12 TK",
"14 TK",
"20 TK",
"30 TK",
"40 TK",
"50 TK",
"60 TK"
];

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -51,46 +70,49 @@ class _fuelcountState extends State<fuelcount> {
child: Column(
children: [
Container(
child: SearchField(
hint: 'search',
searchInputDecoration: InputDecoration(
labelText: 'From',
hintText: 'From',
prefixIcon: Icon(Icons.add_location),
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.green, width: 1),
borderRadius: BorderRadius.circular(10)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.green.withOpacity(0.8),
width: 2),
borderRadius: BorderRadius.circular(10)),
border: OutlineInputBorder(),
suffixIcon: Icon(Icons.search)),
itemHeight: 50,
maxSuggestionsInViewPort: 6,
suggestionsDecoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
suggestions: [
'Muradpur',
'Boddorhat',
'GEC',
'Lalkhan Bazar',
'Oxyzen',
'Tiger Pass',
'Wasa',
'DewanHat',
'Chomohuni',
'Agrabad',
],
)),
child: SearchField(
controller: _searchfildcontroller,
hint: 'search',
searchInputDecoration: InputDecoration(
labelText: 'From',
hintText: 'From',
prefixIcon: Icon(Icons.add_location),
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.green, width: 1),
borderRadius: BorderRadius.circular(10)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.green.withOpacity(0.8),
width: 2),
borderRadius: BorderRadius.circular(10)),
border: OutlineInputBorder(),
suffixIcon: Icon(Icons.search)),
itemHeight: 50,
maxSuggestionsInViewPort: 6,
suggestionsDecoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
suggestions: [
'Muradpur',
'Boddorhat',
'GEC',
'Lalkhan Bazar',
'Oxyzen',
'Tiger Pass',
'Wasa',
'DewanHat',
'Chomohuni',
'Agrabad',
],
),
),
SizedBox(
height: 25,
),
Container(
child: SearchField(
controller: _searchfildcontroller2,
hint: 'search',
searchInputDecoration: InputDecoration(
labelText: 'To',
Expand Down Expand Up @@ -147,8 +169,8 @@ class _fuelcountState extends State<fuelcount> {
),
decoration: InputDecoration(
prefixIcon: Icon(Icons.airport_shuttle_rounded),
labelText: "Select Vehicale Type",
hintText: "Select Vehicale Type",
labelText: "Select Vehicle Type",
hintText: "Select Vehicle Type",
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.green, width: 1),
Expand All @@ -159,23 +181,122 @@ class _fuelcountState extends State<fuelcount> {
borderRadius: BorderRadius.circular(10)),
),
),
SizedBox(height: 25),
Container(
child: TextField(
enabled: false,
controller: _rentcount,
decoration: InputDecoration(
labelText: 'Rent is',
hintText: 'Rent is',
prefixIcon: Icon(Icons.account_balance_wallet),
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.green, width: 1),
borderRadius: BorderRadius.circular(10)),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.green, width: 1),
borderRadius: BorderRadius.circular(10)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.green.withOpacity(0.8), width: 2),
borderRadius: BorderRadius.circular(10)),
border: OutlineInputBorder(),
),
)),
SizedBox(
height: 50,
),
MaterialButton(
onPressed: () {},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5))),
child: Text(
"Count",
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
Row(
children: [
MaterialButton(
onPressed: (() {
setState(() {
_searchfildcontroller.text = "";
_searchfildcontroller2.text = "";
_selectedval = _vehicletypes[0];
_rentcount.text = "";
});
}),
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(5))),
child: Text(
"Reset",
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
),
),
color: Colors.yellow.shade800,
height: 50,
minWidth: 142,
),
),
color: Colors.green,
height: 50,
minWidth: 200,
SizedBox(width: 25),
MaterialButton(
onPressed: () {
if (_searchfildcontroller.text ==
_searchfildcontroller2.text) {
showAlertDialog(context);
} else {
if (_searchfildcontroller.text == 'Muradpur' &&
_searchfildcontroller2.text == 'GEC' &&
_selectedval == _vehicletypes[0] ||
_searchfildcontroller2.text == 'Muradpur' &&
_searchfildcontroller.text == 'GEC' &&
_selectedval == _vehicletypes[0]) {
_rentcount.text = _rent[4];
} else if (_searchfildcontroller.text ==
'Muradpur' &&
_searchfildcontroller2.text == 'GEC' &&
_selectedval == _vehicletypes[1] ||
_searchfildcontroller2.text == 'Muradpur' &&
_searchfildcontroller.text == 'GEC' &&
_selectedval == _vehicletypes[1]) {
_rentcount.text = _rent[0];
} else if (_searchfildcontroller.text ==
'Muradpur' &&
_searchfildcontroller2.text == 'GEC' &&
_selectedval == _vehicletypes[2] ||
_searchfildcontroller2.text == 'Muradpur' &&
_searchfildcontroller.text == 'GEC' &&
_selectedval == _vehicletypes[2]) {
_rentcount.text = _rent[5];
} else if (_searchfildcontroller.text ==
'Muradpur' &&
_searchfildcontroller2.text == 'GEC' &&
_selectedval == _vehicletypes[3] ||
_searchfildcontroller2.text == 'Muradpur' &&
_searchfildcontroller.text == 'GEC' &&
_selectedval == _vehicletypes[3]) {
_rentcount.text = _rent[0];
} else if (_searchfildcontroller.text ==
'Muradpur' &&
_searchfildcontroller2.text == 'GEC' &&
_selectedval == _vehicletypes[4] ||
_searchfildcontroller2.text == 'Muradpur' &&
_searchfildcontroller.text == 'GEC' &&
_selectedval == _vehicletypes[4]) {
_rentcount.text = _rent[9];
}
}
},
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(5))),
child: Text(
"Count",
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
),
),
color: Colors.green,
height: 50,
minWidth: 142,
),
],
),
SizedBox(height: 25),
Container(
Expand All @@ -199,3 +320,30 @@ class _fuelcountState extends State<fuelcount> {
);
}
}

showAlertDialog(BuildContext context) {
// Create button
Widget okButton = TextButton(
child: Text("OK"),
onPressed: () {
Navigator.of(context).pop();
},
);

// Create AlertDialog
AlertDialog alert = AlertDialog(
title: Text("⚠ Warning"),
content: Text("Please, Select Two Different locations."),
actions: [
okButton,
],
);

// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dev_dependencies:
flutter_launcher_icons: ^0.11.0

flutter_icons:
android: "launcher_icon"
android: true
ios: true
image_path: "assets/icon/android.png"

Expand Down
2 changes: 1 addition & 1 deletion web/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rentapp",
"name": "Rent Count",
"short_name": "rentapp",
"start_url": ".",
"display": "standalone",
Expand Down

0 comments on commit 46ca76b

Please sign in to comment.