adv_page.dart 1.86 KB
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) {}),
    );
  }
}