adv_page.dart
1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:appframe/bloc/adv_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AdvPage extends StatelessWidget {
const AdvPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => AdvCubit(),
child: BlocConsumer<AdvCubit, AdvState>(
builder: (context, state) {
return Scaffold(
appBar: AppBar(
title: Text(''),
),
// body: Center(
// child: Text(
// '${state.countdown}',
// style: TextStyle(fontSize: 50),
// ),
// ),
body: Stack(children: [
Center(
child: GestureDetector(
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('点击了开屏广告')));
},
child: Text(
'开屏广告',
style: TextStyle(fontSize: 50),
)),
),
Positioned(
bottom: 30,
right: 30,
child: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF7691FA),
),
child: Center(
child: Text(
'${state.countdown}',
style: TextStyle(fontSize: 20, color: Colors.white),
),
),
),
),
]),
);
},
listener: (context, state) {}),
);
}
}