import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart';
import 'package:zhiying_comm/util/extension/color.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class OrderSearchWidget extends StatelessWidget {
  final OrderPageStyleModel model;

  const OrderSearchWidget(this.model, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: 40,
      padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
      color: Colors.white,
      child: Container(
        padding: EdgeInsets.only(left: 12, right: 12),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(16),
            color: HexColor.fromHex(model?.searchBarBgColor ?? '#f7f7f7')),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              width: 16,
              height: 16,
              margin: EdgeInsets.only(right: 4),
              child: CachedNetworkImage(
                imageUrl: model?.searchBarLeftIcon ?? '',
              ),
            ),
            Text(
              model?.searchBarPlaceholder ?? '',
              textAlign: TextAlign.center,
              style: TextStyle(color: Color(0xff999999), fontSize: 14),
            ),
          ],
        ),
      ),
    );
  }
}
