zoukankan      html  css  js  c++  java
  • flutter实例1

    import 'package:flutter/material.dart';

    class LayoutPage extends StatefulWidget {
    @override
    _LayoutPageState createState() => _LayoutPageState();
    }

    class _LayoutPageState extends State<LayoutPage> {

    @override
    Widget build(BuildContext context) {

    // titleSection*
    Widget titleSection = Container(
    padding: const EdgeInsets.all(32.0),
    // color: Colors.red,
    child: Row(
    children: [
    Expanded(
    child: Column(

    // 左靠齐 Column + start
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
    Container(
    padding: const EdgeInsets.only(bottom: 8.0),
    child: Text(
    'If you have problems, you can check your code against lib/main.dart on GitHub.',
    style: TextStyle(fontWeight: FontWeight.bold),
    ),
    ),
    Text(
    'Kandersteg, Switzerland',
    style: TextStyle(color: Colors.grey),
    ),
    ],
    ),
    ),
    Icon(
    Icons.star,
    color: Colors.grey[500],
    ),
    Text('42'),
    ],
    ),
    );

    // buildButtonColumn
    Widget buildButtonColumn(IconData icon, String label) {
    Color color = Theme.of(context).primaryColor;
    return Column(
    mainAxisAlignment: MainAxisAlignment.center,
    mainAxisSize: MainAxisSize.min,
    children: [
    Icon(
    icon,
    color: color,
    ),
    Container(
    child: Text(
    label,
    style: TextStyle(
    fontSize: 12.0, fontWeight: FontWeight.w400, color: color),
    ),
    )
    ],
    );
    }

    Widget buttonSetion = Container(
    child: Row(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: [
    buildButtonColumn(Icons.call, "CALL"),
    buildButtonColumn(Icons.near_me, "ROUTE"),
    buildButtonColumn(Icons.share,'SHARE'),
    ],
    ),
    );

    Widget textSection = Container(
    padding: const EdgeInsets.all(32.0),
    child:
    Text(
    '''
    Lake Oeschinen lies at the foot of the Blüemlisalp in the Bernese Alps.Situated 1,578 meters above sea level, it is one of the larger Alpine Lakes.A gondola ride from Kandersteg, followed by a half-hour walk through pastures and pine forest, leads you to the lake, which warms to 20 degrees Celsius in the summer.Activities enjoyed here include rowing, and riding the summer toboggan run.
    ''',
    softWrap: true,
    ),
    );

    return Scaffold(
    appBar: AppBar(
    title: Text('LayoutPage'),
    ),
    body: ListView(
    children: [
    Image.asset(
    'images/12.jpg',
    600,
    height: 240,
    fit: BoxFit.cover,
    ),
    titleSection,
    buttonSetion,
    textSection,

    ],
    ),
    );
    }
    }

    // ------------titleSection Start---------------
    // Widget titleSection = Container(
    // padding: const EdgeInsets.all(32.0),
    // // color: Colors.red,
    // child: Row(
    // children: [
    // Expanded(
    // child: Column(
    // crossAxisAlignment: CrossAxisAlignment.start,
    // children: [
    // Container(
    // padding: const EdgeInsets.only(bottom: 8.0),
    // child: Text(
    // 'If you have problems, you can check your code against lib/main.dart on GitHub.',
    // style: TextStyle(fontWeight: FontWeight.bold),
    // ),
    // ),
    // Text(
    // 'Kandersteg, Switzerland',
    // style: TextStyle(color: Colors.grey),
    // ),
    // ],
    // ),
    // ),
    // Icon(
    // Icons.star,
    // color: Colors.grey[500],
    // ),
    // Text('42'),
    // ],
    // ),
    // );
    // }
    // ------------titleSection End---------------

    // ------------buildButtonColumn Strat---------------

    // ------------buildButtonColumn End---------------
  • 相关阅读:
    VS2005 新控件之 容器 《PlaceHolder》
    vs2005/.NET2.0 控件演示之 超级链接 《HyperLink》
    VS2005 控件演示之 容器《Panel》
    投票系统[单/复选,投票数量/项随意][C#/SQL/文件包括数据库代码全部在]
    datalgrid\datalist\repeater\的用法以及相关小技巧
    使用XmlDocument类完成对XML的查、删、添、改(不完美,望指教)
    Repeater读取数据并分页
    vs2005控件演示之 MultiView
    datagrid 分页及隐藏指定列再以及鼠标动作(换背景)
    VS2.0控件之日历《Calendar》C#
  • 原文地址:https://www.cnblogs.com/supersr/p/13925764.html
Copyright © 2011-2022 走看看