import 'package:flutter/material.dart';

class OrderTabbarWidget extends StatelessWidget {
  final TabController controller;
  final List<String> titles;

  const OrderTabbarWidget(
    this.controller,
    this.titles, {
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
        width: double.infinity,
        height: 40,
        color: Colors.white,
        child: Row(
          children: <Widget>[
            Expanded(
              child: TabBar(
                controller: controller,
                isScrollable: true,
                indicatorSize: TabBarIndicatorSize.label,
                tabs: titles
                    .map((title) => OrderTabbarItemWidget(title: title))
                    .toList(),
              ),
            ),
            Container(
              width: 40,
              height: 40,
              child: Icon(
                Icons.filter_4,
                size: 14,
              ),
            )
          ],
        ));
  }
}

class OrderTabbarItemWidget extends StatelessWidget {
  final String title;

  const OrderTabbarItemWidget({Key key, this.title}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 26,
      child: Text(
        title,
        style: TextStyle(color: Color(0xFFFF4242)),
      ),
    );
  }
}
