import 'package:flutter/material.dart';
import '../../custom_icons/icons_data.dart';
import '../../custom_icons/icons_name.dart';

class DetailsPage extends StatelessWidget {
  final String arguments; //id of icon

  DetailsPage({Key key, this.arguments = 'text'}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    String s = '图标ID    ：$arguments' + '\n图标名称：' + iconNameList[int.parse(arguments)];

    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back),
          onPressed: () {
            print('返回上一页');
            Navigator.pop(context);
          },
        ),
        title: Text('联系人详情页'),
      ),
      body: FutureBuilder(
        future: null,
        builder: (context, snapshot) {
          if (snapshot.hasData) {
            return Stack(
              children: <Widget>[
                ListView(
                  children: <Widget>[
                    Text(arguments),
                  ],
                ),
                Positioned(
                  bottom: 0,
                  left: 0,
                  child: null,
                )
              ],
            );
          } else {
            //return Text('加载中........');
            return Container(
              alignment: Alignment(0, 0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Icon(
                    iconList[int.parse(arguments)],
                    size: 200,
                    color: Colors.black,
                  ),
                  SizedBox(height: 10,),
                  Text(s),
                ],
              ),
            );
          }
        },
      ),
    );
  }
}
