flutter3示例頁

飞雪飘鸿發表於2024-06-27
import 'package:flutter/material.dart';

void main() {
  runApp(const GoWaterMyApp());
}

class GoWaterMyApp extends StatelessWidget {
  const GoWaterMyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'GoWater',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
            seedColor: const Color.fromARGB(1, 64, 158, 255)),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: '系統'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SafeArea(
        child: Container(),
      ),
//導航開始
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: Colors.lightBlue,
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: '收貨',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.widgets),
            label: '記錄',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.location_on),
            label: '位置',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.settings),
            label: '自己',
          ),
        ],
      ),
//導航結束
    );
  }
}

  

相關文章