
import 'package:flutter/material.dart';
import 'package:twong/config/style.dart';

import 'package:twong/utils/index.dart';
import 'package:twong/models/index.dart';
import 'package:twong/widgets/app_bar.dart';
import 'package:twong/widgets/cart_item.dart';
import 'package:twong/widgets/rank_stars.dart';

class OrderCommentPage extends StatefulWidget {
  final CartInfo info;
  OrderCommentPage(this.info);

  @override
  State<StatefulWidget> createState() {
    return _OrderCommentState();
  }
}

class _OrderCommentState extends State<OrderCommentPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: DAppBar("商品评价"),
      backgroundColor: DColors.back,
      body: Container(
        margin: EdgeInsets.only(left: 12.px, right: 12.px),
        child: ListView(
          physics: ClampingScrollPhysics(),
          children: [
            Container(
              child: CartItem(widget.info),
              padding: EdgeInsets.all(6.px),
              margin: EdgeInsets.only(top: 6.px),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(6.px)
              ),
            ),
            Divider(),
            Container(
              padding: EdgeInsets.all(6.px),
              decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(6.px)
              ),
              child: Column(
                children: [
                  RankStars(5, value: 5, color: DColors.Main, header: Text("商品质量:")),
                  RankStars(5, color: DColors.Main, header: Text("服务态度:")),
                  TextField(
                    maxLines: 3,
                    style: TextStyle(fontSize: 12.px),
                    decoration: InputDecoration(
                      border: InputBorder.none,
                      hintText: "说说您的想法，分享给大家吧~",
                      enabledBorder: OutlineInputBorder(
                        borderSide: BorderSide(color: Color(0x00FF00a0)),
                        borderRadius: BorderRadius.all(
                          Radius.circular(100),
                        ),
                      ),
                      focusedBorder: OutlineInputBorder(
                        borderSide: BorderSide(color: Color(0x000000a0)),
                        borderRadius: BorderRadius.all(
                          Radius.circular(100),
                        ),
                      ),
                    ),
                  ),
                  Stack(
                    children: [
                      Container(
                        height: 32.px,
                        child: Center(child: Text("上传图片")),
                      )
                    ],
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 12.px, right: 12.px),
                    width: double.infinity,
                    child: FlatButton(
                      onPressed: () {},
                      color: DColors.Main,
                      textColor: Colors.white,
                      shape: StadiumBorder(),
                      child: Text("立即评价"),
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}