import 'package:flutter/material.dart'; class AdBanner extends StatelessWidget { const AdBanner({super.key}); @override Widget build(BuildContext context) { return Stack( children: <Widget>[ // 主要内容 Container( height: 100.0, color: Colors.lightBlue, child: const Center( child: Text( '主要内容', style: TextStyle(color: Colors.white, fontSize: 20), ), ), ), // 广告banner Positioned( bottom: 0.0, left: 0.0, right: 0.0, child: Container( color: Colors.black54, padding: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), child: const Text( '这是一个广告', style: TextStyle(color: Colors.white, fontSize: 16), ), ), ), ], ); } } void main() { runApp(const MaterialApp(home: AdBanner())); }
标签:const,color,0.0,AdBanner,Colors,flutter3,child,广告 From: https://www.cnblogs.com/xiongwei/p/18279271