Skip to content

Commit b1f1404

Browse files
authored
V1/bug/font size (#36)
* Error widget integrated * Error widget integrated * Dynamic UI * Minor UI fixes * Profile Name Dynamic Size * Event card overflow issue * App signin for playstore
1 parent 83a5370 commit b1f1404

File tree

17 files changed

+234
-91
lines changed

17 files changed

+234
-91
lines changed

android/app/build.gradle

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727
apply plugin: 'com.google.gms.google-services'
2828

29+
def keystoreProperties = new Properties()
30+
def keystorePropertiesFile = rootProject.file('key.properties')
31+
if (keystorePropertiesFile.exists()) {
32+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
33+
}
34+
2935
android {
3036
compileSdkVersion 33
3137
ndkVersion flutter.ndkVersion
@@ -41,16 +47,24 @@ android {
4147
// You can update the following values to match your application needs.
4248
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
4349
minSdkVersion 21
44-
targetSdkVersion 30
50+
targetSdkVersion 31
4551
versionCode flutterVersionCode.toInteger()
4652
versionName flutterVersionName
4753
}
4854

55+
signingConfigs {
56+
release {
57+
keyAlias keystoreProperties['keyAlias']
58+
keyPassword keystoreProperties['keyPassword']
59+
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
60+
storePassword keystoreProperties['storePassword']
61+
}
62+
}
63+
4964
buildTypes {
5065
release {
51-
// TODO: Add your own signing config for the release build.
52-
// Signing with the debug keys for now, so `flutter run --release` works.
53-
signingConfig signingConfigs.debug
66+
signingConfig signingConfigs.release
67+
// signingConfig signingConfigs.debug
5468
}
5569
}
5670
}

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.pasc.pulzion23">
3+
<uses-permission android:name="android.permission.INTERNET" />
34
<application
45
android:label="Pulzion 23"
56
android:name="${applicationName}"
@@ -31,4 +32,4 @@
3132
android:name="flutterEmbedding"
3233
android:value="2" />
3334
</application>
34-
</manifest>
35+
</manifest>

assets/images/coming_soon.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/services/size_config.dart renamed to lib/config/size_config.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:developer';
2+
13
import 'package:flutter/material.dart';
24

35
class SizeConfig {
@@ -12,19 +14,28 @@ class SizeConfig {
1214
screenHeight = _mediaQueryData!.size.height;
1315
screenWidth = _mediaQueryData!.size.width;
1416
orientation = _mediaQueryData!.orientation;
17+
18+
log("Screen Height: $screenHeight");
19+
log("Screen Width: $screenWidth");
1520
}
1621

1722
static double getProportionateScreenHeight(double inputHeight) {
1823
double? screenHeight = SizeConfig.screenHeight;
19-
// 812 is the layout height that designer use
24+
// 932 is the layout height that designer use
25+
26+
return (inputHeight / 932.0) * screenHeight!;
27+
}
28+
29+
static double getProportionateScreenWidth(double inputWidth) {
30+
double? screenWidth = SizeConfig.screenWidth;
31+
// 430 is the layout Width that designer use
2032

21-
return (inputHeight / 812.0) * screenHeight!;
33+
return (inputWidth / 430.0) * screenWidth!;
2234
}
2335

24-
static getProportionateScreenWidth(double inputWidth) {
36+
static double getProportionateScreenFontSize(double inputFontSize) {
2537
double? screenWidth = SizeConfig.screenWidth;
26-
// 375 is the layout Width that designer use
2738

28-
return (inputWidth / 375.0) * screenWidth!;
39+
return inputFontSize * screenWidth! / screenHeight! * 2.5;
2940
}
3041
}

lib/constants/styles.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
11
import 'package:flutter/material.dart';
22

3+
import '../config/size_config.dart';
34
import 'colors.dart';
45

56
class AppStyles {
67
static TextStyle bodyTextStyle1() {
7-
return const TextStyle(
8-
fontSize: 30,
8+
return TextStyle(
9+
fontSize: SizeConfig.getProportionateScreenFontSize(30),
910
fontWeight: FontWeight.normal,
1011
fontFamily: 'Roboto',
1112
color: AppColors.black,
1213
);
1314
}
1415

1516
static TextStyle bodyTextStyle2() {
16-
return const TextStyle(
17-
fontSize: 20,
17+
return TextStyle(
18+
fontSize: SizeConfig.getProportionateScreenFontSize(15),
1819
fontWeight: FontWeight.w600,
1920
fontFamily: 'Panther',
2021
color: AppColors.cardTitleTextColor,
2122
);
2223
}
2324

2425
static TextStyle bodyTextStyle3() {
25-
return const TextStyle(
26-
fontSize: 12,
26+
return TextStyle(
27+
fontSize: SizeConfig.getProportionateScreenFontSize(12),
2728
fontWeight: FontWeight.normal,
2829
fontFamily: 'QuickSand',
2930
color: AppColors.cardSubtitleTextColor,
3031
);
3132
}
3233

3334
static TextStyle bodyTextStyle4() {
34-
return const TextStyle(
35-
fontSize: 15,
35+
return TextStyle(
36+
fontSize: SizeConfig.getProportionateScreenFontSize(15),
3637
fontWeight: FontWeight.w500,
3738
fontFamily: 'Panther',
3839
color: AppColors.cardTitleTextColor,
3940
);
4041
}
4142

4243
static TextStyle bodyTextStyle5() {
43-
return const TextStyle(
44-
fontSize: 15,
44+
return TextStyle(
45+
fontSize: SizeConfig.getProportionateScreenFontSize(15),
4546
fontWeight: FontWeight.bold,
4647
fontFamily: 'QuickSand',
4748
color: AppColors.white,

lib/constants/widgets/error_dialog.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ import '../styles.dart';
77

88
class ErrorDialog extends StatelessWidget {
99
final String errorMessage;
10-
final VoidCallback refreshFunction;
11-
const ErrorDialog(this.errorMessage, this.refreshFunction, {super.key});
10+
final VoidCallback? refreshFunction;
11+
12+
const ErrorDialog(
13+
this.errorMessage, {
14+
super.key,
15+
this.refreshFunction,
16+
});
1217

1318
@override
1419
Widget build(BuildContext context) {
@@ -51,7 +56,9 @@ class ErrorDialog extends StatelessWidget {
5156
),
5257
TextButton(
5358
onPressed: () {
54-
refreshFunction();
59+
if (refreshFunction != null) {
60+
refreshFunction!();
61+
}
5562
},
5663
child: Row(
5764
crossAxisAlignment: CrossAxisAlignment.center,

lib/features/event_description/ui/event_description.dart

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../../../constants/models/event_model.dart';
44
import '../../../constants/colors.dart';
55
import '../../../constants/images.dart';
66
import '../../../constants/styles.dart';
7+
import '../../../pages/more_page/ui/coming_soon.dart';
78

89
class EventDescription extends StatefulWidget {
910
final Events? event;
@@ -80,33 +81,43 @@ class _EventDescriptionState extends State<EventDescription>
8081
),
8182
),
8283
Expanded(
83-
child: Container(
84-
decoration: BoxDecoration(
85-
color: Colors.blueAccent,
86-
borderRadius: BorderRadius.circular(12),
87-
gradient: const LinearGradient(
88-
colors: [Color(0xff07f49e), Color(0xff42047e)],
89-
begin: Alignment.centerLeft,
90-
end: Alignment.centerRight,
84+
child: InkWell(
85+
onTap: () {
86+
Navigator.push(
87+
context,
88+
MaterialPageRoute(
89+
builder: (context) => const ComingSoonPage(),
90+
),
91+
);
92+
},
93+
child: Container(
94+
decoration: BoxDecoration(
95+
color: Colors.blueAccent,
96+
borderRadius: BorderRadius.circular(12),
97+
gradient: const LinearGradient(
98+
colors: [Color(0xff07f49e), Color(0xff42047e)],
99+
begin: Alignment.centerLeft,
100+
end: Alignment.centerRight,
101+
),
91102
),
92-
),
93-
child: Padding(
94-
padding: const EdgeInsets.all(12.0),
95-
child: Row(
96-
mainAxisAlignment: MainAxisAlignment.center,
97-
children: [
98-
Text(
99-
"Add to Cart ",
100-
style: AppStyles.bodyTextStyle3().copyWith(
101-
fontSize: 18,
102-
fontWeight: FontWeight.bold,
103+
child: Padding(
104+
padding: const EdgeInsets.all(12.0),
105+
child: Row(
106+
mainAxisAlignment: MainAxisAlignment.center,
107+
children: [
108+
Text(
109+
"Add to Cart ",
110+
style: AppStyles.bodyTextStyle3().copyWith(
111+
fontSize: 18,
112+
fontWeight: FontWeight.bold,
113+
),
103114
),
104-
),
105-
const Icon(
106-
Icons.shopping_cart,
107-
color: Colors.white,
108-
),
109-
],
115+
const Icon(
116+
Icons.shopping_cart,
117+
color: Colors.white,
118+
),
119+
],
120+
),
110121
),
111122
),
112123
),
@@ -122,15 +133,16 @@ class _EventDescriptionState extends State<EventDescription>
122133
Stack(
123134
children: [
124135
SizedBox(
125-
width: w,
136+
height: h * 0.28,
137+
width: double.infinity,
126138
child: Image.asset(
127139
AppImages.eventDescriptionBackground,
128140
fit: BoxFit.cover,
129141
),
130142
),
131143
Container(
132144
height: h * 0.28,
133-
// width: w,
145+
width: double.infinity,
134146
decoration: BoxDecoration(
135147
gradient: LinearGradient(
136148
begin: Alignment.topCenter,

lib/features/home_page/ui/home_page_final.dart

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import 'dart:developer';
2+
13
import 'package:flutter/material.dart';
24
import 'package:flutter_bloc/flutter_bloc.dart';
35
import 'package:lottie/lottie.dart';
46
import 'package:panorama/panorama.dart';
57
import 'package:sizer/sizer.dart';
68

9+
import '../../../config/size_config.dart';
710
import '../../../constants/colors.dart';
811
import '../../../constants/images.dart';
912
import '../../../constants/styles.dart';
13+
import '../../../constants/widgets/error_dialog.dart';
1014
import '../logic/event_details_cubit_cubit.dart';
1115
import 'wigets/event_gridview.dart';
1216

@@ -92,8 +96,10 @@ class _HomePageContentState extends State<HomePageContent>
9296
Center(
9397
child: Text(
9498
"Pulzion '23",
95-
style:
96-
AppStyles.bodyTextStyle2().copyWith(fontSize: 45),
99+
style: AppStyles.bodyTextStyle2().copyWith(
100+
fontSize:
101+
SizeConfig.getProportionateScreenFontSize(30),
102+
),
97103
),
98104
),
99105
],
@@ -152,7 +158,15 @@ class _HomePageContentState extends State<HomePageContent>
152158
} else if (state is EventDetailsCubitLoading) {
153159
return Center(child: Lottie.asset(AppImages.loadingAnimation));
154160
} else {
155-
return const Center(child: Text("Something went wrong"));
161+
return Center(
162+
child: ErrorDialog(
163+
'Error while fetching data from server',
164+
refreshFunction: () {
165+
log("refreshing");
166+
context.read<EventDetailsCubitCubit>().getEventsDetails();
167+
},
168+
),
169+
);
156170
}
157171
},
158172
);

lib/features/home_page/ui/wigets/event_card.dart

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:math';
33
import 'package:flutter/material.dart';
44
import 'package:lottie/lottie.dart';
55

6+
import '../../../../config/size_config.dart';
67
import '../../../../constants/colors.dart';
78
import '../../../../constants/images.dart';
89
import '../../../../constants/models/event_model.dart';
@@ -35,10 +36,13 @@ class EventCard extends StatelessWidget {
3536
alignment: Alignment.topCenter,
3637
children: [
3738
Transform.translate(
38-
offset: Offset(0, MediaQuery.of(context).size.width / 10),
39+
offset: Offset(
40+
0,
41+
SizeConfig.getProportionateScreenHeight(43),
42+
),
3943
child: Container(
4044
margin: EdgeInsets.only(
41-
bottom: MediaQuery.of(context).size.width / 8,
45+
bottom: SizeConfig.getProportionateScreenWidth(53),
4246
),
4347
decoration: BoxDecoration(
4448
gradient: LinearGradient(
@@ -56,10 +60,10 @@ class EventCard extends StatelessWidget {
5660
),
5761
child: Padding(
5862
padding: EdgeInsets.only(
59-
top: MediaQuery.of(context).size.width / 5,
60-
left: 10,
61-
right: 10,
62-
bottom: 10,
63+
top: SizeConfig.getProportionateScreenHeight(80),
64+
left: SizeConfig.getProportionateScreenWidth(10),
65+
right: SizeConfig.getProportionateScreenWidth(10),
66+
bottom: SizeConfig.getProportionateScreenHeight(10),
6367
),
6468
child: Column(
6569
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -70,6 +74,13 @@ class EventCard extends StatelessWidget {
7074
style: AppStyles.bodyTextStyle2(),
7175
overflow: TextOverflow.ellipsis,
7276
maxLines: 1,
77+
// Note: This is issue in flutter -> https://github.com/flutter/flutter/issues/98975
78+
strutStyle: StrutStyle(
79+
height: 1.2,
80+
fontSize: SizeConfig.getProportionateScreenFontSize(15),
81+
fontWeight: FontWeight.w600,
82+
fontFamily: 'Panther',
83+
),
7384
),
7485
Text(
7586
event.description!,
@@ -120,7 +131,9 @@ class EventCard extends StatelessWidget {
120131
),
121132
),
122133
child: Padding(
123-
padding: const EdgeInsets.all(8.0),
134+
padding: EdgeInsets.all(
135+
SizeConfig.getProportionateScreenWidth(10),
136+
),
124137
child: Image.asset(
125138
'assets/images${event.logo!}',
126139
),

0 commit comments

Comments
 (0)