1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| class Home extends StatelessWidget { const Home({Key? key}) : super(key: key);
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Work'), leading: const Icon(Icons.menu), actions: const[Icon(Icons.settings)], ), body: const MyPage(), floatingActionButton: FloatingActionButton( tooltip: "挖草", backgroundColor: Colors.orange, onPressed: (){ if(kDebugMode){ print("FloatingActionButton"); } }, child: const Icon(Icons.live_tv), ), ); } }
class MyPage extends StatelessWidget { const MyPage({Key? key}) : super(key: key);
@override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(2), child: Wrap( children: [ TextButton( style: const ButtonStyle( ), onPressed: (){ if (kDebugMode) { print("TextButton"); } }, child: const Text( "TextButton", style: TextStyle( fontSize: 25 ), ), ), ElevatedButton( onPressed: (){ if(kDebugMode){ print("ElevatedButton"); } }, child: const Text("ElevatedButton"), ), OutlinedButton( style: ButtonStyle( minimumSize: MaterialStateProperty.all(const Size(400,40)), foregroundColor: MaterialStateProperty.resolveWith((states){ if(states.contains(MaterialState.pressed)){ return Colors.red; } }), backgroundColor: MaterialStateProperty.all(Colors.orange), side: MaterialStateProperty.all(const BorderSide( width: 3, color: Colors.green )), shape: MaterialStateProperty.all(const StadiumBorder()), ), onPressed: (){ if(kDebugMode) { print("OutlinedButton"); } }, child: const Text( "OutlinedButton", style: TextStyle( color: Colors.white ), ), ), IconButton( tooltip: "小辣鸡", onPressed: (){ if(kDebugMode){ print("IconButton"); } }, icon: const Icon(Icons.favorite,color: Colors.red,) ), TextButton.icon( onPressed: (){ if(kDebugMode){ print("TextButton.icon"); } }, icon: const Icon(Icons.person), label: const Text("Khvia")), ], ), ); } }
|