
import 'package:flutter/material.dart';
import 'package:twong/config/protocols.dart';
import 'package:twong/config/style.dart';
import 'package:twong/router/base.dart';
import 'package:twong/utils/index.dart';
import 'package:twong/widgets/app_bar.dart';

class AboutPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: DAppBar("关于我们"),
      body: SafeArea(
        child: Column(
          children: [
            Expanded(child: _buildLogo()),
            _buildButtons(context),
            _buildBottom()
          ],
        ),
      ),
    );
  }

  Widget _buildLogo() {
    return Container(
      margin: EdgeInsets.only(bottom: 186.px),
      child: Center(
        child: Image(image: AssetImage("assets/images/logo.png"), width: 128.px),
      ),
    );
  }

  Widget _buildButtons(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(bottom: 36.px),
      child: Column(
        children: [
          Container(
            width: 108.px,
            child: OutlineButton(onPressed: () {
              Navigator.pushNamed(context, RouteNames.protocol, arguments: ProtocolType.USER);
            }, child: Text("用户注册协议"), highlightColor: Colors.transparent),
          ),
          Container(
            width: 108.px,
            child: OutlineButton(onPressed: () {
              Navigator.pushNamed(context, RouteNames.protocol, arguments: ProtocolType.PRIVATE);
            }, child: Text("隐私政策"), highlightColor: Colors.transparent),
          ),
          Container(
            child: Text("V1.0.0"),
          )
        ],
      ),
    );
  }

  Widget _buildBottom() {
    return Container(
      margin: EdgeInsets.only(bottom: 16.px),
      child: Wrap(
        children: [
          Text("Copyright - 美天旺-郑州完璧时空网络科技有限公司 - All rights reserved"
          ,textAlign: TextAlign.center, style: TextStyle(fontSize: 10.px))
        ],
      ),
    );
  }
}