視訊直播系統原始碼,平臺在日間和夜間模式之間來回切換

zhibo系統開發發表於2022-01-06

視訊直播系統原始碼,平臺在日間和夜間模式之間來回切換實現的相關程式碼

import 'package:flutter/material.dart';
import 'package:flutter_widget/router/applicationRouterGradual.dart';
import 'package:flutter_widget/router/applicationRouterSlide.dart';
import 'package:flutter_widget/widget/layout.dart';
 
class HomeContent extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _HomeContentState();
  }
}
 
class _HomeContentState extends State<HomeContent> {
  final List arrayRouter = [
    {
      'router': '/statelessWidget',
      'title': 'statelessWidget 容器元件',
      'desc': 'statelessWidget 容器元件'
    },
    {
      'router': '/statefulWidget',
      'title': 'statefulWidget 容器元件',
      'desc': 'statefulWidget 容器元件'
    },
    {
      'router': '/statefulWidget',
      'title': 'statefulWidget 容器元件',
      'desc': 'statefulWidget 容器元件'
    },
    {
      'router': '/gesturePage',
      'title': 'Flutter 手勢識別',
      'desc': 'Flutter 手勢識別',
    },
    {
      'router': '/assetsSource',
      'title': 'Flutter 資源載入',
      'desc': 'Flutter 資源載入',
    },
    {
      'router': '/openApplicaiton',
      'title': 'Flutter 開啟第三方應用',
      'desc': 'Flutter 開啟第三方應用',
    },
    {
      'router': '/flutterLife',
      'title': 'Flutter Widget 生命週期',
      'desc': 'Flutter Widget 生命週期',
    },
    {
      'router': '/flutterApplicationLife',
      'title': 'Flutter 應用 生命週期',
      'desc': 'Flutter 應用 生命週期',
    },
  ];
  bool modelDay = true;
  Brightness appBrightness = Brightness.light;
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      title: 'Flutter 基礎學習',
      theme: ThemeData(
        // fontFamily: 'TianShi',//全域性字型設定
        brightness: appBrightness,
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("flutter 元件的學習"),
          actions: [
            Center(child: Text("主題切換")),
            Switch(
                activeColor: Colors.orange,
                value: modelDay,
                onChanged: (value) {
                  setState(() {  //切換主題
                    this.modelDay = value;
                    appBrightness =
                        this.modelDay ? Brightness.light : Brightness.dark;
                  });
                })
          ],
        ),
        body: SingleChildScrollView(
          child: Center(
            child: Column(
              children: arrayRouter
                  .map(
                    (item) => MaterialButton(
                      onPressed: () {
                        // Navigator.push(context,
                        //     MaterialPageRoute(builder: (context) => Layout()));
                        Navigator.pushNamed(context, item['router'],
                            arguments: {'desc': item['desc']});
                        //Navigator.push(context, ApplicationRouterGradual())
                        // Navigator.push(context,
                        //     ApplicationRouterGradual(widget: LessGroupPage()));
                        // Navigator.push(context, route)
                        // Navigator.push(context,
                        //     ApplicationRouterSlide(widget: LessGroupPage()));
                      },
                      color: Colors.cyan,
                      splashColor: Colors.green,
                      elevation: 10,
                      child: Text(
                        item['title'],
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                  )
                  .toList(),
            ),
          ),
        ),
      ),
    );
  }
}

以上就是 視訊直播系統原始碼,平臺在日間和夜間模式之間來回切換實現的相關程式碼,更多內容歡迎關注之後的文章


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2850957/,如需轉載,請註明出處,否則將追究法律責任。

相關文章