void main() {
print('Hello world! - dart.jsrun.net');
}import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ProfilePage(),
);
}
}
class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
SystemNavigator.pop();
},
),
backgroundColor: Colors.blue,
elevation: 0,
),
body: Container(
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.blue, Colors.blue.shade800],
),
),
child: Column(
children: [
SizedBox(height: 24),
CircleAvatar(
radius: 48,
backgroundColor: Colors.green,
child: Text(
"头像",
style: TextStyle(fontSize: 24, color: Colors.white),
),
),
SizedBox(height: 8),
Text(
"头像1",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white),
),
SizedBox(height: 4),
Text(
"0x8ff0b63102baad...5874",
style: TextStyle(fontSize: 16, color: Colors.white70),
),
SizedBox(height: 24),
MenuItem(title: "修改钱包名称", icon: Icons.edit),
MenuItem(title: "导出助记词", icon: Icons.vpn_key),
Spacer(),
Padding(
padding: EdgeInsets.all(16.0),
child: ElevatedButton(
onPressed: () {},
child: Text('删除钱包'),
style: ElevatedButton.styleFrom(
primary: Colors.red,
minimumSize: Size(double.infinity, 50),
),
),
),
],
),
),
);
}
}
class MenuItem extends StatelessWidget {
final String title;
final IconData icon;
const MenuItem({
Key? key,
required this.title,
required this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ListTile(
leading: Icon(icon, color: Colors.white),
title: Text(title, style: TextStyle(color: Colors.white)),
onTap: () {},
trailing: Icon(Icons.arrow_forward_ios, color: Colors.white),
);
}
}