要让Flutter应用程序在整个屏幕上包含一个伸展的背景图像,并且有一个返回句子的图像的圆形按钮,可以按照以下步骤进行:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
children: [
// 背景图像
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/background_image.jpg'),
fit: BoxFit.cover,
),
),
),
// 返回句子的图像的圆形按钮
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(bottom: 20.0),
child: GestureDetector(
onTap: () {
// 点击按钮触发的操作
print('返回句子的图像的圆形按钮被点击了');
},
child: Container(
width: 80.0,
height: 80.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
child: Icon(
Icons.arrow_back,
color: Colors.white,
size: 40.0,
),
),
),
),
),
],
),
),
);
}
}
flutter:
assets:
- assets/background_image.jpg
这是一个简单的示例,你可以根据实际需求进行修改和扩展。
领取专属 10元无门槛券
手把手带您无忧上云