Commit f10acc47 authored by nazeerxexagen's avatar nazeerxexagen

frontend init

parent bd066a99
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited. # This file should be version controlled and should not be manually edited.
version: version:
revision: db747aa1331bd95bc9b3874c842261ca2d302cd5 revision: c860cba910319332564e1e9d470a17074c1f2dfd
channel: stable channel: stable
project_type: app project_type: app
# frontend # pettahmate
A new Flutter project. A new Flutter project.
......
...@@ -43,8 +43,8 @@ android { ...@@ -43,8 +43,8 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.frontend" applicationId "com.aries.pettahmate"
minSdkVersion flutter.minSdkVersion minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
...@@ -63,6 +63,10 @@ flutter { ...@@ -63,6 +63,10 @@ flutter {
source '../..' source '../..'
} }
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:29.3.0')
} }
{
"project_info": {
"project_number": "16403513664",
"firebase_url": "https://pettahmate-default-rtdb.asia-southeast1.firebasedatabase.app",
"project_id": "pettahmate",
"storage_bucket": "pettahmate.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:16403513664:android:a24c3802af292324cb7aa5",
"android_client_info": {
"package_name": "com.aries.pettahmate"
}
},
"oauth_client": [
{
"client_id": "16403513664-3n3dlna0qn7glgjlqii2j2pnkhu8ipq7.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCyIg7qcA2dtREcvLXXu0pSmM-DyeAgqmg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "16403513664-3n3dlna0qn7glgjlqii2j2pnkhu8ipq7.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.frontend"> package="com.aries.pettahmate">
<!-- Flutter needs it to communicate with the running application <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.frontend"> package="com.aries.pettahmate">
<application <application
android:label="frontend" android:label="pettahmate"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
......
package com.example.frontend package com.aries.pettahmate
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.frontend"> package="com.aries.pettahmate">
<!-- Flutter needs it to communicate with the running application <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
......
...@@ -7,6 +7,7 @@ buildscript { ...@@ -7,6 +7,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
......
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.frontend; PRODUCT_BUNDLE_IDENTIFIER = com.aries.pettahmate;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
...@@ -422,7 +422,7 @@ ...@@ -422,7 +422,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.frontend; PRODUCT_BUNDLE_IDENTIFIER = com.aries.pettahmate;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
...@@ -444,7 +444,7 @@ ...@@ -444,7 +444,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.example.frontend; PRODUCT_BUNDLE_IDENTIFIER = com.aries.pettahmate;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>Frontend</string> <string>Pettahmate</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>frontend</string> <string>pettahmate</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
......
import 'package:firebase_database/firebase_database.dart';
import 'package:pettahmate/Models/FirebaseStructure.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:pettahmate/Models/User.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Auth/Login.dart';
class AuthController {
static late FirebaseAuth _auth;
late DatabaseReference _databaseRef;
AuthController() {
_auth = FirebaseAuth.instance;
_databaseRef = FirebaseDatabase.instance.ref();
}
Future<bool> checkAuth() async {
if (_auth.currentUser == null) {
return false;
} else {
Utils.profileUser = await getUserData();
return true;
}
}
Future<dynamic> doDoctorRegistration(data) async {
var key = null;
await _auth
.createUserWithEmailAndPassword(
email: data['email'],
password: data['password'],
)
.then((value) async {
await _databaseRef
.child(FirebaseStructure.USERS)
.child(value.user!.uid)
.set({
'name': data['name'],
'mobile': data['mobile'],
'type': data['type']
});
key = value.user!.uid;
}).catchError((e) {
Utils.showToast(e.toString());
});
return key;
}
Future<void> doDoctorUpdate(userid, data) async {
await _databaseRef.child(FirebaseStructure.USERS).child(userid).set(data);
}
Future<bool> doRegistration(data) async {
bool check = true;
await _auth
.createUserWithEmailAndPassword(
email: data['email'],
password: data['password'],
)
.then((value) async {
await _databaseRef
.child(FirebaseStructure.USERS)
.child(value.user!.uid)
.set({
'name': data['name'],
'mobile': data['mobile'],
'type': data['type']
});
Utils.showToast('Successfully Registered. Please Login Now.');
}).catchError((e) {
check = false;
Utils.showToast(e.toString());
});
return check;
}
Future<bool> doLogin(data) async {
bool check = true;
await _auth
.signInWithEmailAndPassword(
email: data['email'],
password: data['password'],
)
.catchError((e) {
check = false;
late String errorMessage;
switch (e.code) {
case 'invalid-email':
case 'user-not-found':
case 'wrong-password':
errorMessage = 'Invalid credentails.';
break;
case 'user-disabled':
errorMessage = 'Account has been disabled.';
break;
default:
errorMessage = 'Something wrong.';
}
Utils.showToast(errorMessage);
}).then((value) async {
Utils.profileUser = await getUserData();
});
return check;
}
Future<void> logout(context) async {
await _auth.signOut();
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => Login()));
}
Future<ProfileUser> getUserData() async {
late ProfileUser user;
if (_auth.currentUser != null) {
await _databaseRef
.child(FirebaseStructure.USERS)
.child(_auth.currentUser!.uid)
.once()
.then((DatabaseEvent event) {
Map<dynamic, dynamic> profileUserData = event.snapshot.value as Map;
if (event.snapshot.value != null) {
user = ProfileUser(
name: profileUserData['name'],
email: _auth.currentUser!.email,
mobile: profileUserData['mobile'],
type: profileUserData['type'],
uid: _auth.currentUser!.uid);
}
});
}
return user;
}
Future<void> sendRecoverLink(email) async {
await _auth.sendPasswordResetEmail(email: email);
}
}
import 'package:email_validator/email_validator.dart';
class AuthValidator {
static dynamic validateUsername(String value) {
if (value.isNotEmpty) {
if (!EmailValidator.validate(value)) {
return 'Please check your username.';
}
} else {
return 'Please fill username';
}
}
static dynamic validatePassword(String value) {
if (value.isNotEmpty) {
if (value.length < 8) {
return 'Invalid password (Min : 8 Characters)';
}
} else {
return 'Please fill password';
}
}
static dynamic validateName(String value) {
if (value.isNotEmpty) {
if (value.length < 2) {
return 'Invalid name (Min : 2 Characters)';
}
} else {
return 'Please fill name';
}
}
static dynamic validateMobile(String value) {
if (value.isNotEmpty) {
if (value.length != 10) {
return 'Invalid Mobile Number';
}
} else {
return 'Please fill name';
}
}
static dynamic validateRetypePassword(String password, String value) {
if (value.isNotEmpty) {
if (value.length < 8) {
return 'Invalid retype password (Min : 8 Characters)';
} else {
if (password != value) {
return 'Mismatching passwords, Please recheck';
}
}
} else {
return 'Please fill same password';
}
}
}
import 'package:firebase_database/firebase_database.dart';
import 'package:pettahmate/Models/Category.dart';
import 'package:pettahmate/Models/FirebaseStructure.dart';
import 'package:pettahmate/Models/Utils.dart';
class CategoryController {
static late final DatabaseReference _databaseRef =
FirebaseDatabase.instance.ref();
Future<void> saveCategory(Category category) async {
await _databaseRef
.child(FirebaseStructure.USERS)
.child(Utils.profileUser.uid)
.child(FirebaseStructure.CATEGORIES)
.push()
.set(category);
}
}
import 'package:pettahmate/Controllers/Auth/AuthController.dart';
class SplashScreenController {
Future<bool> checkAuth() async {
return await AuthController().checkAuth();
}
}
class Category {
var key, name, mainKey, mainName;
Category({this.key, this.mainKey, this.mainName, required this.name});
}
import 'package:flutter/material.dart';
class UtilColors {
static Color primaryColor = const Color.fromRGBO(241, 177, 33, 1.0);
static Color primaryColorLight = const Color.fromRGBO(243, 190, 67, 1.0);
static Color secondaryColor = const Color.fromRGBO(97, 160, 64, 1.0);
static Color secondaryColorLight = const Color.fromRGBO(108, 177, 71, 1.0);
static Color whiteColor = const Color.fromRGBO(250, 250, 250, 1.0);
static Color whiteColorLight = const Color.fromRGBO(255, 255, 255, 1.0);
static Color blackColor = const Color.fromRGBO(33, 33, 33, 1.0);
static Color greyColor = const Color.fromRGBO(158, 158, 158, 1.0);
static Color greyColorDark = const Color.fromRGBO(97, 97, 97, 1.0);
static Color primaryStatusBarColor = const Color.fromRGBO(0, 0, 0, 1);
static Color redColor = const Color.fromRGBO(198, 40, 40, 1);
static Color greenColor = const Color.fromRGBO(76, 175, 80, 1);
static Color blueColor = const Color.fromRGBO(21, 101, 192, 1);
static Color purpleColor = const Color.fromRGBO(106, 27, 154, 1);
static Color orangeColor = const Color.fromRGBO(239, 108, 0, 1);
static Color orangeDarkColor = const Color.fromRGBO(230, 81, 0, 1);
}
class FirebaseStructure {
static String USERS = "users";
static String CATEGORIES = "categories";
static String PRODUCTS = "products";
}
class UtilImages {
static var logoPNG = 'assets/img/logo.png';
static var textLogoPNG = 'assets/img/textlogo.png';
static var userPNG = 'assets/img/user_sample.png';
static var bannerPNG = 'assets/img/banner.png';
static var categoryManagementPNG = 'assets/img/category.png';
}
class UtilStrings {
static var splashScreen = 'Powered By ARIES (Pvt) Ltd.';
static var appTitle = 'Pettah Mate';
static var appTitleSection1 = 'Pettah';
static var appTitleSection2 = 'Mate';
static var appSubtitle = 'Tag tracking AI based application';
static var loginSubTitle = 'Unlock your access with existing account';
static var registrationTitle = 'Registration';
static var registrationSubTitle = 'Create your free account';
static var forgetPasswordSubTitle = 'Recover your account password';
}
class ProfileUser {
var uid, name, mobile, email,type;
ProfileUser({this.uid, this.name, this.mobile, this.email,this.type});
}
import 'package:auto_size_text/auto_size_text.dart';
import 'package:pettahmate/Models/Strings.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/User.dart';
import 'package:pettahmate/Views/Widgets/PopUps/Confirmation.dart';
import 'package:pettahmate/Views/Widgets/PopUps/PopUpLoading.dart';
import 'package:pettahmate/Views/Widgets/PopUps/showSummery.dart';
class Utils {
//Fonts Start
static double smallFonts = 10.0;
static double xlFonts = 30.0;
//Fonts End
static String googleMapsKey = 'AIzaSyD8HZ9Is3SwaYwv9WiTvWZIKwVH15M8Dbw';
static late Size displaySize;
static late ProfileUser profileUser;
static var loadingMessage;
static double carbsValue = 0.0;
static double fatValue = 0.0;
static Map<String, dynamic> dataMap = {};
static var imageResponse;
static var lightNavbar = SystemUiOverlayStyle.light.copyWith(
statusBarBrightness: Brightness.light,
systemNavigationBarColor: UtilColors.blackColor,
statusBarColor: UtilColors.primaryStatusBarColor);
static var darkNavbar = SystemUiOverlayStyle.dark.copyWith(
statusBarBrightness: Brightness.light,
systemNavigationBarColor: UtilColors.blackColor,
statusBarColor: UtilColors.primaryStatusBarColor);
//TextStyles
static TextStyle getprimaryStyle(Color color) {
return GoogleFonts.openSans(color: color);
}
static TextStyle getprimaryStyleSmall(Color color) {
return GoogleFonts.openSans(color: color, fontSize: 13.0);
}
static TextStyle getprimaryBoldStyle(Color color) {
return GoogleFonts.openSans(color: color, fontWeight: FontWeight.bold);
}
static TextStyle getprimaryFieldTextStyle(Color color) {
return GoogleFonts.openSans(color: UtilColors.blackColor, fontSize: 13.0);
}
static TextStyle getprimaryFieldTextStyle2(Color color) {
return GoogleFonts.openSans(color: color, fontSize: 13.0);
}
static TextStyle getprimaryFieldTextStylePopUp(Color color) {
return GoogleFonts.openSans(color: UtilColors.primaryColor, fontSize: 13.0);
}
//TextFormField Styles
static double borderRadius = 5.0;
static double buttonBorderRadius = 5.0;
static InputDecoration getDefaultTextInputDecoration(
String label, suffixIcon) {
return InputDecoration(
labelText: label,
errorStyle: const TextStyle(fontSize: 11, color: Colors.red),
contentPadding:
const EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
labelStyle: TextStyle(fontSize: 12.0, color: UtilColors.greyColor),
suffixIcon: suffixIcon,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: const BorderSide(),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: UtilColors.primaryColorLight, width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: UtilColors.primaryColor, width: 1),
));
}
static InputDecoration getDefaultDropDownInputDecoration(
String label) {
return InputDecoration(
labelText: label,
contentPadding:
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
errorStyle: const TextStyle(fontSize: 11, color: Colors.red),
labelStyle: TextStyle(fontSize: 13.0, color: UtilColors.greyColor),
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: const BorderSide(),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: UtilColors.primaryColor, width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(borderRadius),
borderSide: BorderSide(color: UtilColors.primaryColor, width: 1),
));
}
//Loading Widgets
static bool checkShowLoader = false;
static late BuildContext parentLoadingContext;
static Widget getListLoader() {
return Wrap(
children: const [
Padding(
padding: EdgeInsets.only(top: 50.0),
child: CircularProgressIndicator(),
)
],
);
}
static Future showLoader(context) async {
await showDialog(
context: context,
builder: (_) => PopUpLoading(),
).then((onValue) {
parentLoadingContext = context;
checkShowLoader = true;
});
}
static Future showConfirmation(context, okFunction, noFunction) async {
await showDialog(
context: context,
builder: (_) =>
Confirmation(okFunction: okFunction, noFunction: noFunction),
).then((onValue) {
parentLoadingContext = context;
checkShowLoader = true;
});
}
static Future<void> doCalculation(context) async {
await showDialog(
context: context,
builder: (_) => showSummery(),
).then((onValue) {
parentLoadingContext = context;
checkShowLoader = true;
});
}
static Future showLoaderWithCustomMessage(context, message) async {
Utils.loadingMessage = message;
await showDialog(
context: context,
builder: (_) => PopUpLoading(),
).then((onValue) {
parentLoadingContext = context;
checkShowLoader = true;
});
}
static Future hideLoader() async {
if (checkShowLoader == true && parentLoadingContext != null) {
Navigator.pop(parentLoadingContext);
checkShowLoader = false;
Utils.loadingMessage = null;
}
}
static Future hideLoaderCurrrent(context) async {
Navigator.pop(context);
checkShowLoader = false;
}
//Toast Contents
static showToast(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.black,
textColor: Colors.white,
fontSize: 14.0);
}
static getGradientBackground() {
return BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
tileMode: TileMode.decal,
end: Alignment.bottomLeft,
colors: [
UtilColors.primaryColor,
UtilColors.secondaryColor,
],
));
}
static getTextGradient() {
return LinearGradient(
colors: <Color>[UtilColors.primaryColor, UtilColors.secondaryColor],
).createShader(Rect.fromLTWH(0.0, 0.0, 200.0, 70.0));
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Images.dart';
import 'package:pettahmate/Models/Strings.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Category/NewUpdateCategory.dart';
import 'package:pettahmate/Views/Common/ManagementAppBar.dart';
class CategoryManagement extends StatefulWidget {
CategoryManagement({Key? key}) : super(key: key);
@override
State<CategoryManagement> createState() => _CategoryManagementState();
}
class _CategoryManagementState extends State<CategoryManagement> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Column(
children: [
ManagementAppBar(title: "Categories", tailingIcons: [
Padding(
padding:
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0),
child: GestureDetector(
onTap: () {
showModalBottomSheet<void>(
context: context, builder: (BuildContext context) {
return NewUpdateCategory();
});
},
child: const Icon(Icons.add_box)),
)
]),
Expanded(
child: Center(
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 5.0, horizontal: 5.0),
child: ListView(
children: [
Card(
child: ListTile(
leading: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.category,
color: UtilColors.primaryColor,
)
],
),
title: Text(
"Mobile Phones",
style: GoogleFonts.openSans(
fontSize: 14.0, fontWeight: FontWeight.w600),
),
subtitle: Text(
"Electronics",
style: GoogleFonts.openSans(
fontSize: 12.0,
fontWeight: FontWeight.w600,
color: UtilColors.greyColor),
),
trailing: Wrap(
direction: Axis.horizontal,
children: [
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Icon(
Icons.edit,
color: UtilColors.orangeColor,
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Icon(
Icons.delete,
color: UtilColors.redColor,
),
),
],
),
),
)
],
),
),
))
],
),
));
}
}
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Category.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Images.dart';
import 'package:pettahmate/Models/Utils.dart';
class NewUpdateCategory extends StatefulWidget {
NewUpdateCategory({Key? key}) : super(key: key);
@override
State<NewUpdateCategory> createState() => _NewUpdateCategoryState();
}
class _NewUpdateCategoryState extends State<NewUpdateCategory> {
var _formKey = GlobalKey<FormState>();
var categoryList = [Category(name: "- Select -", key: "none" ),Category(name: "Mobile Phones", key: "1" ),Category(name: "Electronics", key: "2" )];
String? category;
@override
void initState() {
setState(() {
category = (categoryList.isNotEmpty) ? categoryList.first.key : null;
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
child: Form(
key: _formKey,
child: Wrap(
spacing: 1.0,
children: [
Text("New Category", style: GoogleFonts.openSans(fontSize: 15.0)),
const SizedBox(
height: 40.0,
),
TextFormField(
decoration: Utils.getDefaultTextInputDecoration(
'Category / Sub Category',
Icon(Icons.category,
color: UtilColors.greyColor.withOpacity(0.6))),
cursorColor: UtilColors.primaryColor,
keyboardType: TextInputType.emailAddress,
style: Utils.getprimaryFieldTextStyle(UtilColors.blackColor),
validator: (value) {
if (value!.isEmpty) {
return "Please enter category or sub category name";
}
},
),
const SizedBox(
height: 20.0,
),
SizedBox(
height: 50.0,
child: InputDecorator(
decoration:
Utils.getDefaultDropDownInputDecoration('Main Category'),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: category,
onChanged: (String? newValue) {
setState(() {
category = newValue!;
});
},
items: categoryList
.map<DropdownMenuItem<String>>((Category value) {
return DropdownMenuItem<String>(
value: value.key,
child: Text(value.name,style: TextStyle(color: (value.key=="none")?UtilColors.greyColor:UtilColors.blackColor, fontSize: 13), ),
);
}).toList(),
),
),
),
),
const SizedBox(
height: 20.0,
),
SizedBox(
width: double.infinity,
height: 50.0,
child: TextButton(
child: Text(
"Save",
style: GoogleFonts.openSans(),
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all<Color>(UtilColors.whiteColor),
backgroundColor:
MaterialStateProperty.all<Color>(UtilColors.greenColor),
),
onPressed: () async {
if (_formKey.currentState!.validate()) {
}
},
),
)
],
)),
);
}
}
import 'package:flutter/material.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Utils.dart';
class ManagementAppBar extends StatefulWidget {
String title;
List<Widget> tailingIcons;
ManagementAppBar({Key? key, required this.title, required this.tailingIcons})
: super(key: key);
@override
State<ManagementAppBar> createState() => _ManagementAppBarState(
title: this.title, tailingIcons: this.tailingIcons);
}
class _ManagementAppBarState extends State<ManagementAppBar> {
String title;
List<Widget> tailingIcons;
_ManagementAppBarState({required this.title, required this.tailingIcons});
@override
Widget build(BuildContext context) {
return Expanded(
flex: 0,
child: Container(
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(20.0),
bottomLeft: Radius.circular(20.0))),
width: Utils.displaySize.width,
child: Stack(
alignment: Alignment.center,
children: [
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 15.0, horizontal: 20.0),
child: GestureDetector(
onTap: () => Navigator.pop(context),
child: const Icon(Icons.arrow_back_ios)),
)),
Align(
alignment: Alignment.center,
child: Text(title),
),
Align(
alignment: Alignment.topRight,
child: Visibility(
visible: (tailingIcons.isNotEmpty) ? true : false,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: tailingIcons,
)),
)
],
)),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Controllers/Common/SplashScreenController.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Images.dart';
import 'package:pettahmate/Models/Strings.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Auth/Login.dart';
import 'package:pettahmate/Views/Dashboard/Dashboard.dart';
import 'package:pettahmate/Views/Home/Home.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({Key? key}) : super(key: key);
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
late Timer _timer;
@override
void initState() {
super.initState();
startApp();
}
@override
void dispose() {
_timer.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
Utils.displaySize = MediaQuery.of(context).size;
return SafeArea(
child: Scaffold(
body: Container(
color: UtilColors.whiteColor,
child: Stack(
children: [
Positioned(
top: -Utils.displaySize.width * 0.5 / 2,
left: -Utils.displaySize.width * 0.5 / 2,
child: ClipRect(
child: Container(
width: Utils.displaySize.width * 0.8,
height: Utils.displaySize.width * 0.8,
decoration: BoxDecoration(
color: UtilColors.primaryColor.withOpacity(0.5),
borderRadius: BorderRadius.circular(200.0)),
),
)),
Positioned(
bottom: -Utils.displaySize.width * 0.5 / 2,
right: -Utils.displaySize.width * 0.5 / 2,
child: ClipRect(
child: Container(
width: Utils.displaySize.width * 0.8,
height: Utils.displaySize.width * 0.8,
decoration: BoxDecoration(
color: UtilColors.primaryColor.withOpacity(0.5),
borderRadius: BorderRadius.circular(200.0)),
),
)),
Align(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: Utils.displaySize.width * 0.5,
height: Utils.displaySize.width * 0.5,
child: Image.asset(
UtilImages.textLogoPNG,
fit: BoxFit.cover,
),
),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 20.0),
child: Text(UtilStrings.splashScreen,
style: GoogleFonts.openSans(color: UtilColors.blackColor)),
),
)
],
),
),
));
}
void startApp() async {
await SplashScreenController().checkAuth().then((value) {
_timer = Timer.periodic(
const Duration(seconds: 3),
(t) => Navigator.of(context, rootNavigator: true).pushReplacement(
MaterialPageRoute(
builder: (_) => (value == true) ? const Dashboard() : Login()),
));
});
}
}
import 'package:flutter/material.dart';
import 'package:pettahmate/Controllers/Auth/AuthController.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Strings.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Home/Drawer.dart';
import 'package:pettahmate/Views/Home/Home.dart';
class Dashboard extends StatefulWidget {
const Dashboard({Key? key}) : super(key: key);
@override
State<Dashboard> createState() => _DashboardState();
}
class _DashboardState extends State<Dashboard> {
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static const List<Widget> _widgetOptions = <Widget>[
Home(),
Text(
'Index 1: Business',
style: optionStyle,
),
Text(
'Index 2: School',
style: optionStyle,
),
];
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
final _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
drawer: const HomeDrawer(),
body: Column(
children: [
Expanded(
flex: 0,
child: Container(
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(20.0),
bottomLeft: Radius.circular(20.0))),
width: Utils.displaySize.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 15.0, horizontal: 20.0),
child: GestureDetector(
onTap: () {
if (_scaffoldKey.currentState!.hasDrawer) {
if (_scaffoldKey.currentState!.isDrawerOpen) {
_scaffoldKey.currentState!.openEndDrawer();
} else {
_scaffoldKey.currentState!.openDrawer();
}
}
},
child: const Icon(Icons.menu),
),
),
Text(UtilStrings.appTitle),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 15.0, horizontal: 20.0),
child: GestureDetector(
onTap: () => AuthController().logout(context),
child: const Icon(Icons.logout),
),
)
],
),
),
),
Expanded(
child: Center(
child: _widgetOptions.elementAt(_selectedIndex),
))
],
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: UtilColors.primaryColor,
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart),
label: 'Basket',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'Favorite',
),
],
currentIndex: _selectedIndex,
selectedItemColor: UtilColors.blackColor,
onTap: _onItemTapped,
),
));
}
}
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Category/CategoryManagement.dart';
import 'package:pettahmate/Views/Profile/Profile.dart';
import 'package:pettahmate/Views/Shop/NewShop.dart';
class HomeDrawer extends StatefulWidget {
const HomeDrawer({Key? key}) : super(key: key);
@override
State<HomeDrawer> createState() => _HomeDrawerState();
}
class _HomeDrawerState extends State<HomeDrawer> {
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: [
Container(
color: UtilColors.primaryColor,
child: SizedBox(
height: Utils.displaySize.width * 0.5,
width: Utils.displaySize.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 85,
width: 85.0,
child: GestureDetector(
onTap: () => Navigator.push(context,
MaterialPageRoute(builder: (_) => Profile())),
child: ClipRRect(
borderRadius: BorderRadius.circular(53.0),
child: SizedBox(
height: 80,
width: 80.0,
child: Image.asset("assets/img/user_sample.png"),
),
),
),
),
Text(
"Pasindu",
style: GoogleFonts.openSans(
fontSize: 18.0,
color: UtilColors.whiteColorLight,
fontWeight: FontWeight.w600,
),
),
Text(
"adpasindupriyashan@gmail.com",
style: GoogleFonts.openSans(
fontSize: 13.0,
color: UtilColors.whiteColorLight,
),
),
Text(
"+97 77 977 8269",
style: GoogleFonts.openSans(
fontSize: 13.0,
color: UtilColors.whiteColorLight,
),
),
],
),
),
),
getDrawerItem("Home", Icons.dashboard, () {}),
getDrawerItem("Category Management", Icons.category, () => Navigator.push(
context, MaterialPageRoute(builder: (_) => CategoryManagement())) ),
getDrawerItem(
"Shop Management",
Icons.shop,
() => Navigator.push(
context, MaterialPageRoute(builder: (_) => NewShop()))),
getDrawerItem(
"Products Management", Icons.production_quantity_limits, () {}),
],
),
);
}
getDrawerItem(String title, IconData production_quantity_limits, func) {
return ListTile(
onTap: func,
tileColor: UtilColors.whiteColor,
leading: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
production_quantity_limits,
size: 18.0,
)
],
),
title: Text(
title,
style: GoogleFonts.openSans(
fontSize: 14.0,
color: UtilColors.blackColor,
fontWeight: FontWeight.w600,
),
),
);
}
}
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Images.dart';
import 'package:pettahmate/Models/Strings.dart';
import 'package:pettahmate/Models/Utils.dart';
import 'package:pettahmate/Views/Widgets/PopUps/ImageBrowser.dart';
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
final double topSpace = Utils.displaySize.width * 0.4;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
backgroundColor: UtilColors.whiteColor,
body: SizedBox(
width: Utils.displaySize.width,
height: Utils.displaySize.height,
child: Column(
children: [
Expanded(
flex: 0,
child: Column(
children: [
const SizedBox(
height: 10.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
margin:
const EdgeInsets.only(left: 10.0, right: 10.0),
child: TextFormField(
decoration: Utils.getDefaultTextInputDecoration(
'Search ',
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius:
BorderRadius.circular(100.0)),
child: Icon(
Icons.image_search,
color: UtilColors.blackColor,
),
),
Container(
margin: const EdgeInsets.symmetric(
horizontal: 10.0),
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius:
BorderRadius.circular(100.0)),
child: Icon(
Icons.multitrack_audio,
color: UtilColors.blackColor,
),
),
],
)),
cursorColor: UtilColors.primaryColor,
keyboardType: TextInputType.emailAddress,
style: Utils.getprimaryFieldTextStyle(
UtilColors.greyColor),
),
)),
],
),
const SizedBox(
height: 10.0,
),
],
)),
CarouselSlider(
options: CarouselOptions(height: 180.0),
items: [1, 2, 3, 4, 5].map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.symmetric(horizontal: 2.0),
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: BorderRadius.circular(10.0)),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Image.asset(
UtilImages.bannerPNG,
fit: BoxFit.cover,
),
));
},
);
}).toList(),
),
const SizedBox(
height: 10.0,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
getCategory("Shoes"),
getCategory("Electronics"),
getCategory("Baby Care"),
getCategory("Kitchen Electronics"),
],
),
),
),
const SizedBox(
height: 10.0,
),
Expanded(
child: GridView.extent(
primary: false,
padding: const EdgeInsets.symmetric(horizontal: 5.0),
crossAxisSpacing: 5,
mainAxisSpacing: 5,
maxCrossAxisExtent: 300.0,
children: <Widget>[
getCard(),
getCard(),
getCard(),
getCard(),
getCard(),
],
))
],
)),
));
}
getCategory(String name) {
return Container(
margin: const EdgeInsets.only(right: 5.0),
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
color: UtilColors.primaryColor),
child: Text(
name,
style: GoogleFonts.openSans(color: UtilColors.blackColor),
),
);
}
getCard() {
return Container(
decoration: BoxDecoration(
border: Border.all(color: UtilColors.primaryColor),
borderRadius: BorderRadius.circular(10.0),
color: UtilColors.whiteColor),
child: Stack(
alignment: AlignmentDirectional.center,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Image.network(
'https://e7.pngegg.com/pngimages/483/759/png-clipart-nike-air-max-nike-free-air-force-shoe-nike-white-outdoor-shoe.png',
fit: BoxFit.cover,
)),
Expanded(
flex: 0,
child: Padding(
padding: const EdgeInsets.only(top: 3.0),
child: Text(
"Shoe Nike Free Air Force",
style: GoogleFonts.openSans(fontSize: 13.0),
),
)),
Expanded(
flex: 0,
child: Padding(
padding: const EdgeInsets.only(top: 3.0, bottom: 5.0),
child: Text(
"Rs. 500.00",
style: GoogleFonts.openSans(fontSize: 20.0),
),
)),
],
),
Positioned(
top: 10.0,
right: 5.0,
child: Container(
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: BorderRadius.circular(50.0)),
child: const Padding(
padding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
child: Icon(Icons.add_shopping_cart),
),
))
],
),
);
}
}
import 'package:flutter/material.dart';
class Profile extends StatefulWidget {
Profile({Key? key}) : super(key: key);
@override
State<Profile> createState() => _ProfileState();
}
class _ProfileState extends State<Profile> {
@override
Widget build(BuildContext context) {
return Container();
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
class NewShop extends StatefulWidget {
NewShop({Key? key}) : super(key: key);
@override
State<NewShop> createState() => _NewShopState();
}
class _NewShopState extends State<NewShop> {
@override
Widget build(BuildContext context) {
return Scaffold(
// body: ,
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Utils.dart';
class Confirmation extends StatefulWidget {
var okFunction, noFunction;
Confirmation({required this.okFunction, required this.noFunction});
@override
State<StatefulWidget> createState() => ConfirmationState(
okFunction: this.okFunction, noFunction: this.noFunction);
}
class ConfirmationState extends State<Confirmation>
with SingleTickerProviderStateMixin {
var okFunction, noFunction;
ConfirmationState({required this.okFunction, required this.noFunction});
@override
Widget build(BuildContext context) {
return Center(
child: Material(
color: Colors.transparent,
child: SizedBox(
width: Utils.displaySize.width * 0.8,
child: Card(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 10.0),
child: Wrap(children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Confirmation',
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.primaryColor),
),
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Text(
'Record found. Do you want to edit personal details?',
style: GoogleFonts.openSans(
fontSize: 12.0, color: UtilColors.primaryColor),
),
),
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.only(right: 10.0),
child: TextButton(
child: Text(
"No",
style: GoogleFonts.openSans(),
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all<Color>(
UtilColors.whiteColor),
backgroundColor:
MaterialStateProperty.all<Color>(
UtilColors.redColor),
),
onPressed: (noFunction != null)
? noFunction
: () async {
Navigator.pop(context);
},
),
),
Padding(
padding: EdgeInsets.only(right: 10.0),
child: TextButton(
child: Text(
"Yes",
style: GoogleFonts.openSans(),
),
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all<Color>(
UtilColors.whiteColor),
backgroundColor:
MaterialStateProperty.all<Color>(
UtilColors.greenColor),
),
onPressed: okFunction,
),
),
],
),
),
],
)
]),
),
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:pettahmate/Models/Colors.dart';
class ImageBrowser extends StatefulWidget {
ImageBrowser({Key? key}) : super(key: key);
@override
State<ImageBrowser> createState() => _ImageBrowserState();
}
class _ImageBrowserState extends State<ImageBrowser> {
final ImagePicker _picker = ImagePicker();
@override
Widget build(BuildContext context) {
return Wrap(
children: [
Container(
padding: const EdgeInsets.symmetric(vertical: 20.0),
color: UtilColors.whiteColor,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () async {
await _picker.pickImage(source: ImageSource.camera);
},
child: Column(
children: [
Container(
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: BorderRadius.circular(50.0)),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 10.0),
child: Icon(
Icons.camera,
),
),
),
const SizedBox(height: 5.0),
const Text('Camera')
],
),
),
GestureDetector(
onTap: () async {
await _picker.pickImage(source: ImageSource.gallery);
},
child: Column(
children: [
Container(
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
decoration: BoxDecoration(
color: UtilColors.primaryColor,
borderRadius: BorderRadius.circular(50.0)),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 10.0),
child: Icon(Icons.image),
),
),
const SizedBox(height: 5.0),
const Text('Gallery')
],
),
),
],
),
),
)
],
);
}
}
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Utils.dart';
class PopUpLoading extends StatefulWidget {
@override
State<StatefulWidget> createState() => PopUpLoadingState();
}
class PopUpLoadingState extends State<PopUpLoading>
with SingleTickerProviderStateMixin {
late AnimationController controller;
late Animation<double> scaleAnimation;
@override
void initState() {
super.initState();
controller =
AnimationController(vsync: this, duration: Duration(milliseconds: 450));
scaleAnimation =
CurvedAnimation(parent: controller, curve: Curves.elasticInOut);
controller.addListener(() {
setState(() {});
});
controller.forward();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: Material(
color: Colors.transparent,
child: ScaleTransition(
scale: scaleAnimation,
child: Container(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
new CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(
UtilColors.primaryColor),
),
SizedBox(
height: 10.0,
),
SizedBox(
width: Utils.displaySize.width * 0.6,
child: Text(
(Utils.loadingMessage == null)
? "Please Wait"
: Utils.loadingMessage.toString(),
textAlign: TextAlign.center,
style: GoogleFonts.openSans(
color: UtilColors.whiteColor, fontSize: 12.0),
),
)
],
),
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:pettahmate/Models/Colors.dart';
import 'package:pettahmate/Models/Utils.dart';
class showSummery extends StatefulWidget {
@override
State<StatefulWidget> createState() => showSummeryState();
}
class showSummeryState extends State<showSummery>
with SingleTickerProviderStateMixin {
int summary1 = 1, summary2 = 1, summary3 = 1, summary4 = 0;
List statusList = ['Not Specified', 'OK', 'NOT BAD', 'BAD'];
List colorList = [
UtilColors.primaryColor,
UtilColors.greenColor,
UtilColors.orangeColor,
UtilColors.redColor
];
double bmi = 0.0;
@override
void initState() {
double weight = double.parse(Utils.dataMap['weight']);
double height = double.parse(Utils.dataMap['height']);
bmi = weight / (height * height);
setState(() {
if (Utils.fatValue == 0.0) {
summary1 = 0;
} else {
if (Utils.dataMap['pal'] == 'Medium' ||
Utils.dataMap['pal'] == 'High') {
if ((double.parse(Utils.dataMap['fastbloodsugar']) < 100 &&
Utils.carbsValue > 25) ||
(Utils.dataMap['lp'] == 'Low' && Utils.fatValue > 35)) {
summary1 = 2;
}
}
}
if (Utils.fatValue == 0.0) {
summary2 = 0;
} else {
if ((Utils.dataMap['lp'] == 'Low' && Utils.fatValue > 6) ||
((Utils.dataMap['lp'] == 'Low' ||
Utils.dataMap['lp'] == 'Medium') &&
Utils.fatValue > 35)) {
summary2 = 2;
}
}
if (Utils.carbsValue == 0.0) {
summary3 = 0;
} else {
if ((Utils.carbsValue > 10 &&
double.parse(Utils.dataMap['fastbloodsugar']) > 120) ||
(Utils.carbsValue > 15 &&
double.parse(Utils.dataMap['fastbloodsugar']) > 100) ||
(Utils.carbsValue > 25 &&
double.parse(Utils.dataMap['fastbloodsugar']) < 100)) {
summary3 = 3;
}
}
if (Utils.fatValue == 0.0) {
summary4 = 0;
} else {
if (Utils.fatValue > 30 || bmi > 25) {
summary4 = 2;
}
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Center(
child: Material(
color: Colors.transparent,
child: SizedBox(
width: Utils.displaySize.width * 0.8,
child: Card(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 10.0),
child: Wrap(children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Summary',
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.primaryColor),
),
const SizedBox(
height: 10.0,
),
Text(
'physical activity medium or high , then Fasting blood sugar < 100 and carbohydrates percentage > 25%'),
SizedBox(
height: 5.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: colorList[summary1]),
padding:
EdgeInsets.symmetric(vertical: 5.0, horizontal: 8.0),
child: Text(statusList[summary1],
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.whiteColor)),
),
const SizedBox(
height: 20.0,
),
Text(
'Lipid High and Fat > 6 % = bad , Lipid Normal or Low and Fat > 35%'),
SizedBox(
height: 5.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: colorList[summary2]),
padding:
EdgeInsets.symmetric(vertical: 5.0, horizontal: 8.0),
child: Text(statusList[summary2],
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.whiteColor)),
),
const SizedBox(
height: 20.0,
),
Text(
'Fasting blood sugar > 120 and Carbohydrates percentage > 10 % = bad , Fasting Blood Sugar > 100 and Carbohydrates percentage > 15 % = bad , Fasting Blood Sugar < 100 and Carbohydrates percentage > 25 %'),
SizedBox(
height: 5.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: colorList[summary3]),
padding:
EdgeInsets.symmetric(vertical: 5.0, horizontal: 8.0),
child: Text(statusList[summary3],
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.whiteColor)),
),
const SizedBox(
height: 20.0,
),
Text('Fat > 30 or BMI > 25'),
SizedBox(
height: 5.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color: colorList[summary4]),
padding:
EdgeInsets.symmetric(vertical: 5.0, horizontal: 8.0),
child: Text(statusList[summary4],
style: GoogleFonts.openSans(
fontSize: 15.0, color: UtilColors.whiteColor)),
),
const SizedBox(
height: 20.0,
),
Align(
alignment: Alignment.center,
child: TextButton(
child: Text(
"Cancel",
style: GoogleFonts.openSans(),
),
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
UtilColors.whiteColor),
backgroundColor: MaterialStateProperty.all<Color>(
UtilColors.redColor),
),
onPressed: () async {
Navigator.pop(context);
},
),
)
],
)
]),
),
),
),
),
);
}
}
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() { import 'package:pettahmate/Views/Common/SplashScreen.dart';
runApp(const MyApp());
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
runApp(MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', debugShowCheckedModeBanner: false,
theme: ThemeData( theme: ThemeData(),
// This is the theme of your application. title: 'Doc APP',
// home: const Scaffold(
// Try running your application with "flutter run". You'll see the body: SplashScreen(),
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Pettah Mate'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
), ),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }
} }
This diff is collapsed.
name: frontend name: pettahmate
description: A new Flutter project. description: A new Flutter project.
publish_to: 'none'
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.16.1 <3.0.0" sdk: ">=2.16.2 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
fluttertoast: ^8.0.8
email_validator: ^2.0.1
cached_network_image: ^3.2.0
permission_handler: ^8.3.0
google_fonts: ^2.2.0
google_sign_in: ^5.2.3
percent_indicator: ^4.0.0
flutter_slidable: ^1.2.0
auto_size_text: ^3.0.0
geolocator: ^8.1.1
http: ^0.13.4
firebase_core: ^1.14.0
firebase_auth: ^3.3.13
firebase_database: ^9.0.10
toggle_switch: ^1.4.0
phone_number: ^0.12.0+1
flutter_datetime_picker: ^1.5.1
intl: ^0.17.0
carousel_slider: ^4.0.0
image_picker: ^0.8.5
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0 flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter: flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true uses-material-design: true
# To add assets to your application, add an assets section, like this: assets:
# assets: - assets/img/logo.png
# - images/a_dot_burr.jpeg - assets/img/textlogo.png
# - images/a_dot_ham.jpeg - assets/img/user_sample.png
- assets/img/banner.png
# An image asset can refer to one or more resolution-specific "variants", see - assets/img/category.png
# https://flutter.dev/assets-and-images/#resolution-aware. \ No newline at end of file
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:frontend/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
<!-- iOS meta tags & icons --> <!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="frontend"> <meta name="apple-mobile-web-app-title" content="pettahmate">
<link rel="apple-touch-icon" href="icons/Icon-192.png"> <link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/> <link rel="icon" type="image/png" href="favicon.png"/>
<title>frontend</title> <title>pettahmate</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
</head> </head>
<body> <body>
......
{ {
"name": "frontend", "name": "pettahmate",
"short_name": "frontend", "short_name": "pettahmate",
"start_url": ".", "start_url": ".",
"display": "standalone", "display": "standalone",
"background_color": "#0175C2", "background_color": "#0175C2",
......
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(frontend LANGUAGES CXX) project(pettahmate LANGUAGES CXX)
set(BINARY_NAME "frontend") set(BINARY_NAME "pettahmate")
cmake_policy(SET CMP0063 NEW) cmake_policy(SET CMP0063 NEW)
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
......
...@@ -89,13 +89,13 @@ BEGIN ...@@ -89,13 +89,13 @@ BEGIN
BEGIN BEGIN
BLOCK "040904e4" BLOCK "040904e4"
BEGIN BEGIN
VALUE "CompanyName", "com.example" "\0" VALUE "CompanyName", "com.aries" "\0"
VALUE "FileDescription", "frontend" "\0" VALUE "FileDescription", "pettahmate" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "frontend" "\0" VALUE "InternalName", "pettahmate" "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" VALUE "LegalCopyright", "Copyright (C) 2022 com.aries. All rights reserved." "\0"
VALUE "OriginalFilename", "frontend.exe" "\0" VALUE "OriginalFilename", "pettahmate.exe" "\0"
VALUE "ProductName", "frontend" "\0" VALUE "ProductName", "pettahmate" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"
END END
END END
......
...@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, ...@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project); FlutterWindow window(project);
Win32Window::Point origin(10, 10); Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720); Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"frontend", origin, size)) { if (!window.CreateAndShow(L"pettahmate", origin, size)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
window.SetQuitOnClose(true); window.SetQuitOnClose(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment