123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import 'package:canteen/pages/food_list_page.dart';
- import 'package:canteen/views/campus_listview.dart';
- import 'package:flutter/material.dart';
- /// Description: 主页
- /// Time : 07/25/2022 Monday
- /// Author : liuyuqi.gov@msn.cn
- class HomePage extends StatefulWidget {
- const HomePage({Key? key}) : super(key: key);
- @override
- State<HomePage> createState() => HomePageState();
- }
- class HomePageState extends State<HomePage> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- /// 标题栏
- appBar: AppBar(
- title: const Text("食堂菜谱"),
- leading: Builder(
- builder: (context) {
- ///返回按钮
- return IconButton(
- icon: const Icon(Icons.arrow_back, color: Colors.white),
- onPressed: () {
- Navigator.pop(context);
- },
- );
- },
- ),
- ),
- body: Container(
- color: Colors.white,
- child: Column(
- children: [
- /// 输入框栏
- Row(children: [
- Expanded(
- child: Container(
- margin: const EdgeInsets.fromLTRB(15, 10, 15, 10),
- padding: const EdgeInsets.fromLTRB(15, 0, 0, 0),
- child: TextField(
- decoration: InputDecoration(
- hintText: "请输入查询内容",
- prefixIcon: Row(children: [
- Icon(Icons.search,
- color: Theme.of(context).primaryColor),
- Icon(Icons.keyboard_arrow_down,
- color: Theme.of(context).primaryColor)
- ]),
- border: InputBorder.none),
- focusNode: () {
- var focusNode = FocusNode();
- focusNode.addListener(() {
- if (focusNode.hasFocus) {
- focusNode.unfocus();
- //跳转至搜索页面
- // Navigator.push(context, route);
- }
- });
- return focusNode;
- }(),
- ),
- decoration: const BoxDecoration(
- color: Color(0xFFF0F0F0),
- borderRadius: BorderRadius.all(Radius.circular(1e18)),
- ),
- )),
- IconButton(
- icon: Icon(Icons.star_border,
- color: Theme.of(context).primaryColor),
- onPressed: () {
- //此处应当跳转至收藏页面
- Navigator.of(context)
- .push(MaterialPageRoute(builder: (context) {
- return FoodListPage();
- }));
- },
- )
- ]),
- CampusListView()
- ],
- ),
- ),
- );
- }
- }
|