main.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import 'package:flutter/material.dart';
  2. //import 'package:fooddeliveryapp/order.dart';
  3. void main() => runApp(MyApp());
  4. class MyApp extends StatelessWidget {
  5. // This widget is the root of your application.
  6. @override
  7. Widget build(BuildContext context) {
  8. return MaterialApp(
  9. routes: {
  10. WelcomePage.routeName: (context) {
  11. return WelcomePage();
  12. },
  13. OrderPage.routeName: (context) => OrderPage(),
  14. StaffInfoPage.routeName: (context) => StaffInfoPage()
  15. },
  16. title: '点餐软件demo',
  17. theme: ThemeData(
  18. // This is the theme of your application.
  19. //
  20. // Try running your application with "flutter run". You'll see the
  21. // application has a blue toolbar. Then, without quitting the app, try
  22. // changing the primarySwatch below to Colors.green and then invoke
  23. // "hot reload" (press "r" in the console where you ran "flutter run",
  24. // or simply save your changes to "hot reload" in a Flutter IDE).
  25. // Notice that the counter didn't reset back to zero; the application
  26. // is not restarted.
  27. primarySwatch: Colors.red,
  28. ),
  29. // home: MyHomePage(title: '点餐软件首页'),
  30. );
  31. }
  32. }
  33. class WelcomePage extends StatelessWidget {
  34. static const routeName = '/';
  35. @override
  36. Widget build(BuildContext context) {
  37. // TODO: implement build
  38. return Scaffold(
  39. appBar: AppBar(
  40. title: Text("点餐软件首页"),
  41. ),
  42. body: Column(
  43. children: <Widget>[
  44. GestureDetector(
  45. child: IndexCard("开台", "开始自主点餐,并进行结算"),
  46. onTap: () => Navigator.pushNamed(context, OrderPage.routeName),
  47. ),
  48. GestureDetector(
  49. child: IndexCard("STAFF", "设备员工信息"),
  50. onTap: () => Navigator.pushNamed(context, StaffInfoPage.routeName),
  51. )
  52. ],
  53. ),
  54. );
  55. }
  56. }
  57. ///Order START
  58. class IndexCard extends StatelessWidget {
  59. var title;
  60. var description;
  61. IndexCard(this.title, this.description);
  62. @override
  63. Widget build(BuildContext context) {
  64. // TODO: implement build
  65. return Container(
  66. padding: EdgeInsets.fromLTRB(12, 12, 12, 0),
  67. child: Card(
  68. // shape: RoundedRectangleBorder(
  69. // borderRadius: BorderRadius.circular(15.0),
  70. // ),
  71. color: Colors.amber,
  72. elevation: 10,
  73. child: Container(
  74. padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
  75. child: Column(
  76. mainAxisSize: MainAxisSize.min,
  77. children: <Widget>[
  78. Row(
  79. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  80. children: <Widget>[
  81. Text(
  82. title,
  83. style: TextStyle(fontSize: 30),
  84. ),
  85. Text(title),
  86. Text(title)
  87. ],
  88. ),
  89. Row(
  90. children: <Widget>[
  91. Icon(Icons.border_color),
  92. Text(description)
  93. ],
  94. )
  95. ],
  96. ),
  97. )),
  98. );
  99. }
  100. }
  101. class OrderPage extends StatefulWidget {
  102. static const routeName = '/order';
  103. @override
  104. State<StatefulWidget> createState() {
  105. // TODO: implement createState
  106. return _OrderPageState();
  107. }
  108. }
  109. class _OrderPageState extends State<OrderPage> {
  110. @override
  111. Widget build(BuildContext context) {
  112. // TODO: implement build
  113. return Scaffold(
  114. appBar: AppBar(title: Text("点单页面")),
  115. body: Center(
  116. child: Column(
  117. children: <Widget>[Text("order页面")],
  118. ),
  119. ),
  120. );
  121. }
  122. }
  123. /// order END
  124. ///STAFF START
  125. class StaffInfoPage extends StatefulWidget {
  126. static const routeName = '/staff';
  127. @override
  128. State<StatefulWidget> createState() => _staffInfoState();
  129. }
  130. class _staffInfoState extends State<StaffInfoPage> {
  131. @override
  132. Widget build(BuildContext context) {
  133. // TODO: implement build
  134. return Scaffold(
  135. appBar: AppBar(
  136. title: Text("员工信息"),
  137. ),
  138. body: Container(
  139. child: Center(
  140. child: Text("STAFF INFORMATION"),
  141. ),
  142. ),
  143. );
  144. }
  145. }
  146. /// STAFF END