Skip to content

Commit d5bda4e

Browse files
committed
Start on google adsense
1 parent 88823dc commit d5bda4e

File tree

4 files changed

+62
-12
lines changed

4 files changed

+62
-12
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:flutter/material.dart';
2+
3+
class MobileAdWidget extends StatelessWidget {
4+
const MobileAdWidget({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
return Container(
9+
margin: const EdgeInsets.symmetric(vertical: 16),
10+
decoration: BoxDecoration(
11+
color: Colors.grey[300],
12+
border: Border.all(color: Colors.black26),
13+
borderRadius: BorderRadius.circular(8),
14+
),
15+
child: const Center(
16+
child: Text(
17+
'Dummy Ad Banner',
18+
style: TextStyle(
19+
fontSize: 16,
20+
color: Colors.black54,
21+
fontWeight: FontWeight.bold,
22+
),
23+
),
24+
),
25+
);
26+
}
27+
}

lib/widgets/ad/my_ads.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import 'package:doffa/widgets/ad/mobile_ad_widget.dart';
2+
import 'package:doffa/widgets/ad/web_ad_widget.dart';
13
import 'package:doffa/widgets/my_container.dart';
2-
import 'package:doffa/widgets/text/my_montserrat.dart';
4+
import 'package:flutter/foundation.dart';
35
import 'package:flutter/material.dart';
46

57
class MyAds extends StatelessWidget {
@@ -12,17 +14,7 @@ class MyAds extends StatelessWidget {
1214
double maxWidth = constraints.maxWidth;
1315
return MyContainer(
1416
maxWidth: maxWidth,
15-
child: Padding(
16-
padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 16),
17-
child: Center(
18-
child: MyMontserrat(
19-
maxWidth: maxWidth,
20-
text: "Google Ads",
21-
sizeFactor: 12,
22-
fontWeight: FontWeight.w400,
23-
),
24-
),
25-
),
17+
child: kIsWeb ? WebAdWidget() : MobileAdWidget(),
2618
);
2719
},
2820
);

lib/widgets/ad/web_ad_widget.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import 'package:flutter/material.dart';
2+
3+
class WebAdWidget extends StatelessWidget {
4+
const WebAdWidget({super.key});
5+
6+
@override
7+
Widget build(BuildContext context) {
8+
return Container(
9+
width: 320,
10+
height: 100,
11+
margin: const EdgeInsets.symmetric(vertical: 16),
12+
decoration: BoxDecoration(
13+
color: Colors.grey[300],
14+
border: Border.all(color: Colors.black26),
15+
borderRadius: BorderRadius.circular(8),
16+
),
17+
child: const Center(
18+
child: Text(
19+
'Dummy Ad Banner',
20+
style: TextStyle(
21+
fontSize: 16,
22+
color: Colors.black54,
23+
fontWeight: FontWeight.bold,
24+
),
25+
),
26+
),
27+
);
28+
}
29+
}

web/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<meta name="mobile-web-app-capable" content="yes">
2626
<meta name="apple-mobile-web-app-status-bar-style" content="black">
2727
<meta name="apple-mobile-web-app-title" content="doffa">
28+
<meta name="google-adsense-account" content="ca-pub-9440501180660894">
29+
2830
<link rel="apple-touch-icon" href="icons/Icon-192.png">
2931

3032
<!-- Favicon -->

0 commit comments

Comments
 (0)