zoukankan      html  css  js  c++  java
  • 命名路由

    // 1、配置路由
    import 'package:flutter/material.dart';

    import 'pages/Tabs.dart';

    import 'pages/Search.dart';
    import 'pages/Form.dart';

    void main() => runApp(MyApp());
    class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    // home:Tabs(),
    initialRoute: '/',
    routes: {
    '/':(contxt)=>Tabs(),
    '/search':(contxt) =>SearchPage(),
    '/form': (context) => FormPage(),
    },
    );
    }
    }

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    // 2、路由跳转
    RaisedButton(
    child: Text("跳转到搜索页面"),
    onPressed: (){
    Navigator.pushNamed(context, '/search');
    },
    color: Theme.of(context).accentColor,
    textTheme: ButtonTextTheme.primary
    )
    ————————————————

  • 相关阅读:
    数据库表关联分析
    java异常信息分析
    版本问题
    项目
    EXCEL工具
    项目安全
    服务器环境
    vue公共
    Linux 文件权限
    nginx
  • 原文地址:https://www.cnblogs.com/ly570/p/11402901.html
Copyright © 2011-2022 走看看