import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('DemoK'),
),
body: Center(
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
border: Border.all(color: Colors.green, width: 10),
shape: BoxShape.circle,
gradient: RadialGradient(colors: [Colors.redAccent,Colors.blueAccent]),
boxShadow: [
BoxShadow(
color: const Color(0xFFd0d0d0),
blurRadius: 1.0,
spreadRadius: 2.0,
offset: Offset(10.0, 10.0),
),
BoxShadow(
color: Colors.redAccent,
blurRadius: 2.0,
spreadRadius: 6.0,
offset: Offset(-20.0, -20.0),
),
]
),
child: InkWell(
onTap: () {
setState(() {
showDialog(
context: context,
builder: (data) {
return SimpleDialog(
backgroundColor: Colors.orange,
title: Text('我是对话框'),
children: <Widget>[
ListTile(
title: Text('hello'),
subtitle: Text('hi,lihua!'),
),
],
);
});
});
},
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.add),
Text(
'hello',
),
],
),
),
),
),
),
);
}
}