Skip to content

Commit 301a64d

Browse files
committed
Implementasikan ScreenUtil dan font Mazzard
1 parent fdd0f2c commit 301a64d

File tree

4 files changed

+69
-7
lines changed

4 files changed

+69
-7
lines changed

assets/fonts/MazzardL_SemiBold.otf

125 KB
Binary file not shown.

lib/main.dart

+54-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:ui';
22

33
import 'package:flutter/material.dart';
4+
import 'package:flutter_screenutil/flutter_screenutil.dart';
45

56
void main() => runApp(MyApp());
67

@@ -16,9 +17,11 @@ class MyApp extends StatelessWidget {
1617
class MyHomePage extends StatelessWidget {
1718
@override
1819
Widget build(BuildContext context) {
20+
ScreenUtil.init(context);
1921
MediaQueryData mediaQueryData = MediaQuery.of(context);
2022
double heightScreen = mediaQueryData.size.height;
2123
double paddingTop = mediaQueryData.padding.top;
24+
double paddingBottom = mediaQueryData.padding.bottom;
2225
return Scaffold(
2326
body: Container(
2427
width: double.infinity,
@@ -59,7 +62,52 @@ class MyHomePage extends StatelessWidget {
5962
'assets/images/img_tree_beach.jpg',
6063
),
6164
),
62-
65+
Padding(
66+
padding: EdgeInsets.only(
67+
top: paddingTop,
68+
bottom: paddingBottom,
69+
),
70+
child: Column(
71+
children: <Widget>[
72+
Expanded(
73+
child: Center(
74+
child: Text(
75+
'Meditation',
76+
style: TextStyle(
77+
color: Colors.white,
78+
fontFamily: 'MazzardSemiBold',
79+
fontSize: 36,
80+
),
81+
),
82+
),
83+
),
84+
Expanded(
85+
child: Center(
86+
child: Text(
87+
'Daydream',
88+
style: TextStyle(
89+
color: Colors.white,
90+
fontFamily: 'MazzardSemiBold',
91+
fontSize: 36,
92+
),
93+
),
94+
),
95+
),
96+
Expanded(
97+
child: Center(
98+
child: Text(
99+
'Sensations',
100+
style: TextStyle(
101+
color: Colors.white,
102+
fontFamily: 'MazzardSemiBold',
103+
fontSize: 36,
104+
),
105+
),
106+
),
107+
),
108+
],
109+
),
110+
),
63111
],
64112
),
65113
),
@@ -74,17 +122,17 @@ class WavyImage extends StatelessWidget {
74122

75123
@override
76124
Widget build(BuildContext context) {
77-
MediaQueryData mediaQueryData = MediaQuery.of(context);
78-
double heightScreen = mediaQueryData.size.height;
79125
return ClipPath(
80126
child: Stack(
81127
children: <Widget>[
82128
Image.asset(
83129
img,
84130
fit: BoxFit.cover,
85-
height: heightScreen / 2,
131+
height: 1150.w,
132+
),
133+
ContainerBlack(
134+
heightScreen: 1150.w,
86135
),
87-
ContainerBlack(heightScreen: heightScreen),
88136
],
89137
),
90138
clipper: WaveClipper(),
@@ -158,7 +206,7 @@ class ContainerBlack extends StatelessWidget {
158206
@override
159207
Widget build(BuildContext context) {
160208
return Container(
161-
height: heightScreen / 2,
209+
height: heightScreen,
162210
color: Colors.black.withOpacity(0.5),
163211
);
164212
}

pubspec.lock

+8-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ packages:
6969
description: flutter
7070
source: sdk
7171
version: "0.0.0"
72+
flutter_screenutil:
73+
dependency: "direct main"
74+
description:
75+
name: flutter_screenutil
76+
url: "https://pub.dartlang.org"
77+
source: hosted
78+
version: "1.1.0"
7279
flutter_test:
7380
dependency: "direct dev"
7481
description: flutter
@@ -192,4 +199,4 @@ packages:
192199
source: hosted
193200
version: "3.5.0"
194201
sdks:
195-
dart: ">=2.4.0 <3.0.0"
202+
dart: ">=2.6.0 <3.0.0"

pubspec.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ dependencies:
1313
# Use with the CupertinoIcons class for iOS style icons.
1414
cupertino_icons: ^0.1.2
1515

16+
# A flutter plugin for adapting screen and font size.
17+
flutter_screenutil: ^1.1.0
18+
1619
dev_dependencies:
1720
flutter_test:
1821
sdk: flutter
@@ -46,6 +49,10 @@ flutter:
4649
# - asset: fonts/TrajanPro.ttf
4750
# - asset: fonts/TrajanPro_Bold.ttf
4851
# weight: 700
52+
fonts:
53+
- family: MazzardSemiBold
54+
fonts:
55+
- asset: assets/fonts/MazzardL_SemiBold.otf
4956
#
5057
# For details regarding fonts from package dependencies,
5158
# see https://flutter.dev/custom-fonts/#from-packages

0 commit comments

Comments
 (0)