Skip to content

Commit

Permalink
V1/bug/font size (#36)
Browse files Browse the repository at this point in the history
* Error widget integrated

* Error widget integrated

* Dynamic UI

* Minor UI fixes

* Profile Name Dynamic Size

* Event card overflow issue

* App signin for playstore
  • Loading branch information
RohanDoshi21 authored Mar 13, 2023
1 parent 83a5370 commit b1f1404
Show file tree
Hide file tree
Showing 17 changed files with 234 additions and 91 deletions.
22 changes: 18 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion
Expand All @@ -41,16 +47,24 @@ android {
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
// signingConfig signingConfigs.debug
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pasc.pulzion23">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="Pulzion 23"
android:name="${applicationName}"
Expand Down Expand Up @@ -31,4 +32,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
1 change: 1 addition & 0 deletions assets/images/coming_soon.json

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions lib/services/size_config.dart → lib/config/size_config.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:developer';

import 'package:flutter/material.dart';

class SizeConfig {
Expand All @@ -12,19 +14,28 @@ class SizeConfig {
screenHeight = _mediaQueryData!.size.height;
screenWidth = _mediaQueryData!.size.width;
orientation = _mediaQueryData!.orientation;

log("Screen Height: $screenHeight");
log("Screen Width: $screenWidth");
}

static double getProportionateScreenHeight(double inputHeight) {
double? screenHeight = SizeConfig.screenHeight;
// 812 is the layout height that designer use
// 932 is the layout height that designer use

return (inputHeight / 932.0) * screenHeight!;
}

static double getProportionateScreenWidth(double inputWidth) {
double? screenWidth = SizeConfig.screenWidth;
// 430 is the layout Width that designer use

return (inputHeight / 812.0) * screenHeight!;
return (inputWidth / 430.0) * screenWidth!;
}

static getProportionateScreenWidth(double inputWidth) {
static double getProportionateScreenFontSize(double inputFontSize) {
double? screenWidth = SizeConfig.screenWidth;
// 375 is the layout Width that designer use

return (inputWidth / 375.0) * screenWidth!;
return inputFontSize * screenWidth! / screenHeight! * 2.5;
}
}
21 changes: 11 additions & 10 deletions lib/constants/styles.dart
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
import 'package:flutter/material.dart';

import '../config/size_config.dart';
import 'colors.dart';

class AppStyles {
static TextStyle bodyTextStyle1() {
return const TextStyle(
fontSize: 30,
return TextStyle(
fontSize: SizeConfig.getProportionateScreenFontSize(30),
fontWeight: FontWeight.normal,
fontFamily: 'Roboto',
color: AppColors.black,
);
}

static TextStyle bodyTextStyle2() {
return const TextStyle(
fontSize: 20,
return TextStyle(
fontSize: SizeConfig.getProportionateScreenFontSize(15),
fontWeight: FontWeight.w600,
fontFamily: 'Panther',
color: AppColors.cardTitleTextColor,
);
}

static TextStyle bodyTextStyle3() {
return const TextStyle(
fontSize: 12,
return TextStyle(
fontSize: SizeConfig.getProportionateScreenFontSize(12),
fontWeight: FontWeight.normal,
fontFamily: 'QuickSand',
color: AppColors.cardSubtitleTextColor,
);
}

static TextStyle bodyTextStyle4() {
return const TextStyle(
fontSize: 15,
return TextStyle(
fontSize: SizeConfig.getProportionateScreenFontSize(15),
fontWeight: FontWeight.w500,
fontFamily: 'Panther',
color: AppColors.cardTitleTextColor,
);
}

static TextStyle bodyTextStyle5() {
return const TextStyle(
fontSize: 15,
return TextStyle(
fontSize: SizeConfig.getProportionateScreenFontSize(15),
fontWeight: FontWeight.bold,
fontFamily: 'QuickSand',
color: AppColors.white,
Expand Down
13 changes: 10 additions & 3 deletions lib/constants/widgets/error_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import '../styles.dart';

class ErrorDialog extends StatelessWidget {
final String errorMessage;
final VoidCallback refreshFunction;
const ErrorDialog(this.errorMessage, this.refreshFunction, {super.key});
final VoidCallback? refreshFunction;

const ErrorDialog(
this.errorMessage, {
super.key,
this.refreshFunction,
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -51,7 +56,9 @@ class ErrorDialog extends StatelessWidget {
),
TextButton(
onPressed: () {
refreshFunction();
if (refreshFunction != null) {
refreshFunction!();
}
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
66 changes: 39 additions & 27 deletions lib/features/event_description/ui/event_description.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../../../constants/models/event_model.dart';
import '../../../constants/colors.dart';
import '../../../constants/images.dart';
import '../../../constants/styles.dart';
import '../../../pages/more_page/ui/coming_soon.dart';

class EventDescription extends StatefulWidget {
final Events? event;
Expand Down Expand Up @@ -80,33 +81,43 @@ class _EventDescriptionState extends State<EventDescription>
),
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(12),
gradient: const LinearGradient(
colors: [Color(0xff07f49e), Color(0xff42047e)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ComingSoonPage(),
),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.blueAccent,
borderRadius: BorderRadius.circular(12),
gradient: const LinearGradient(
colors: [Color(0xff07f49e), Color(0xff42047e)],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Add to Cart ",
style: AppStyles.bodyTextStyle3().copyWith(
fontSize: 18,
fontWeight: FontWeight.bold,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Add to Cart ",
style: AppStyles.bodyTextStyle3().copyWith(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
const Icon(
Icons.shopping_cart,
color: Colors.white,
),
],
const Icon(
Icons.shopping_cart,
color: Colors.white,
),
],
),
),
),
),
Expand All @@ -122,15 +133,16 @@ class _EventDescriptionState extends State<EventDescription>
Stack(
children: [
SizedBox(
width: w,
height: h * 0.28,
width: double.infinity,
child: Image.asset(
AppImages.eventDescriptionBackground,
fit: BoxFit.cover,
),
),
Container(
height: h * 0.28,
// width: w,
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
Expand Down
20 changes: 17 additions & 3 deletions lib/features/home_page/ui/home_page_final.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lottie/lottie.dart';
import 'package:panorama/panorama.dart';
import 'package:sizer/sizer.dart';

import '../../../config/size_config.dart';
import '../../../constants/colors.dart';
import '../../../constants/images.dart';
import '../../../constants/styles.dart';
import '../../../constants/widgets/error_dialog.dart';
import '../logic/event_details_cubit_cubit.dart';
import 'wigets/event_gridview.dart';

Expand Down Expand Up @@ -92,8 +96,10 @@ class _HomePageContentState extends State<HomePageContent>
Center(
child: Text(
"Pulzion '23",
style:
AppStyles.bodyTextStyle2().copyWith(fontSize: 45),
style: AppStyles.bodyTextStyle2().copyWith(
fontSize:
SizeConfig.getProportionateScreenFontSize(30),
),
),
),
],
Expand Down Expand Up @@ -152,7 +158,15 @@ class _HomePageContentState extends State<HomePageContent>
} else if (state is EventDetailsCubitLoading) {
return Center(child: Lottie.asset(AppImages.loadingAnimation));
} else {
return const Center(child: Text("Something went wrong"));
return Center(
child: ErrorDialog(
'Error while fetching data from server',
refreshFunction: () {
log("refreshing");
context.read<EventDetailsCubitCubit>().getEventsDetails();
},
),
);
}
},
);
Expand Down
27 changes: 20 additions & 7 deletions lib/features/home_page/ui/wigets/event_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';

import '../../../../config/size_config.dart';
import '../../../../constants/colors.dart';
import '../../../../constants/images.dart';
import '../../../../constants/models/event_model.dart';
Expand Down Expand Up @@ -35,10 +36,13 @@ class EventCard extends StatelessWidget {
alignment: Alignment.topCenter,
children: [
Transform.translate(
offset: Offset(0, MediaQuery.of(context).size.width / 10),
offset: Offset(
0,
SizeConfig.getProportionateScreenHeight(43),
),
child: Container(
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.width / 8,
bottom: SizeConfig.getProportionateScreenWidth(53),
),
decoration: BoxDecoration(
gradient: LinearGradient(
Expand All @@ -56,10 +60,10 @@ class EventCard extends StatelessWidget {
),
child: Padding(
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width / 5,
left: 10,
right: 10,
bottom: 10,
top: SizeConfig.getProportionateScreenHeight(80),
left: SizeConfig.getProportionateScreenWidth(10),
right: SizeConfig.getProportionateScreenWidth(10),
bottom: SizeConfig.getProportionateScreenHeight(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand All @@ -70,6 +74,13 @@ class EventCard extends StatelessWidget {
style: AppStyles.bodyTextStyle2(),
overflow: TextOverflow.ellipsis,
maxLines: 1,
// Note: This is issue in flutter -> https://github.com/flutter/flutter/issues/98975
strutStyle: StrutStyle(
height: 1.2,
fontSize: SizeConfig.getProportionateScreenFontSize(15),
fontWeight: FontWeight.w600,
fontFamily: 'Panther',
),
),
Text(
event.description!,
Expand Down Expand Up @@ -120,7 +131,9 @@ class EventCard extends StatelessWidget {
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: EdgeInsets.all(
SizeConfig.getProportionateScreenWidth(10),
),
child: Image.asset(
'assets/images${event.logo!}',
),
Expand Down
Loading

0 comments on commit b1f1404

Please sign in to comment.