Newer
Older
flutterBaseApp / lib / ui / pages / demo / iconPage / sample_icon_page.dart
StephanieGitHub on 9 Feb 2021 2 KB first commit
import 'package:base_app/res/index.dart';
import 'package:base_app/ui/pages/main_left_page.dart';
import 'package:base_app/ui/widgets/common/button/large_button_widget.dart';
import 'package:base_app/ui/widgets/common/icon.dart';
import 'package:base_app/utils/util_index.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/// 简洁主页面
class SampleIconPage extends StatelessWidget {
  final String labelId;

  const SampleIconPage({Key key, this.labelId}) : super(key: key); // 页面的labelId

  @override
  Widget build(BuildContext context) {
    // iconFont示例
    Widget iconFontsWidget = new Column(children: [
      Text("单色图标,可设定颜色"),
      Wrap(
        direction: Axis.horizontal,
        alignment: WrapAlignment.start,
        children: <Widget>[
          IconfontIcon(
            iconData: IconfontIcons.icon_add,
            color: Colors.blueAccent,
            size: 25,
          ),
          IconfontIcon(iconData: IconfontIcons.icon_addmessage),
          IconfontIcon(iconData: IconfontIcons.icon_addperson),
          IconfontIcon(iconData: IconfontIcons.icon_addresslist),
          IconfontIcon(iconData: IconfontIcons.icon_affiliations_li),
          IconfontIcon(iconData: IconfontIcons.icon_airplay),
          IconfontIcon(iconData: IconfontIcons.icon_attestation),
          IconfontIcon(iconData: IconfontIcons.icon_boss),
          IconfontIcon(iconData: IconfontIcons.icon_calendar),
          IconfontIcon(iconData: IconfontIcons.icon_camera),
          IconfontIcon(iconData: IconfontIcons.icon_certificate_fil),
          IconfontIcon(iconData: IconfontIcons.icon_coinpurse_line),
          IconfontIcon(iconData: IconfontIcons.icon_compile),
          IconfontIcon(iconData: IconfontIcons.icon_collect)
        ],
      )
    ]);

    Widget imageIconWidget = new Column(children: [
      Text("图片图标"),
      Wrap(
        direction: Axis.horizontal,
        alignment: WrapAlignment.start,
        children: <Widget>[
          imageIcon(icon: 'camera'),
          imageIcon(icon: 'card'),
          imageIcon(icon: 'global'),
          imageIcon(icon: 'image'),
          imageIcon(icon: 'magic'),
          imageIcon(icon: 'position'),
          imageIcon(icon: 'scan'),
          imageIcon(icon: 'setting'),
          imageIcon(icon: 'text'),
          imageIcon(icon: 'warning'),
        ],
      )
    ]);

    // 全局
    return new Scaffold(
        appBar: new AppBar(
          elevation: 0.0, //控件的zindex, 可以隐藏阴影
          title: new Text("icon示例"),
          centerTitle: true, // 标题居中
        ),
        body: SingleChildScrollView(
          physics: BouncingScrollPhysics(),
          child: new Column(
            children: <Widget>[
              Gaps.vGap15,
              Container(margin: EdgeInsets.all(20), child: iconFontsWidget),
              Container(margin: EdgeInsets.all(20), child: imageIconWidget)
            ],
          ),
        ));
  }
}