import 'package:feelverapp/ui/nearme/near_me_detail.dart';
import 'package:feelverapp/ui/shop/shop_Nearby_places.dart';
import 'package:feelverapp/ui/shop/shop_reviews.dart';
import 'package:feelverapp/ui/shop/shop_service.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MainShop extends StatefulWidget {
  @override
  _MainShopState createState() => new _MainShopState();
}

final List<String> entries = <String>['A', 'B', 'C'];

class _MainShopState extends State<MainShop>
    with SingleTickerProviderStateMixin {
  TabController _controller;


  void initState() {
    // TODO: implement initState
    super.initState();
    _controller = new TabController(length: 4, vsync: this);
    _controller.addListener(_handleTabSelection);
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _controller.dispose();
    super.dispose();
  }

  void _handleTabSelection() {
    setState(() {
    });
  }


  @override
  Widget build(BuildContext context) {
    SizeConfig(context);
    return new Scaffold(
      appBar: new AppBar(
        leading: IconButton(
          icon: Icon(Icons.arrow_back_ios, color: Colors.white),
          onPressed: () => Navigator.of(context).pop(),
        ),
        backgroundColor: Color.fromRGBO(106, 179, 170, 1),
        title: new Text(
          'Thai Body Balance',
          style: TextStyle(color: Colors.white, fontSize: 25),
        ),
        elevation: 0,
      ),
      body: new ListView(
        children: <Widget>[
          // new Card(
          //   child: new ListTile(
          //     title: const Text('Some information'),
          //   ),
          // ),

          new Container(
            padding: const EdgeInsets.only(bottom: 25, top: 15),
            decoration: new BoxDecoration(
              color: Color.fromRGBO(106, 179, 170, 1),
            ),
            child: new TabBar(
              indicatorColor: Colors.transparent,
              controller: _controller,
              tabs: [
                new Tab(
                  icon: Icon(Icons.assignment,
                      color: _controller.index == 0
                          ? Colors.yellowAccent
                          : Colors.white),
                  child: Text(
                    'ข้อมูลร้าน',
                    style: TextStyle(
                        color: _controller.index == 0
                            ? Colors.yellowAccent
                            : Colors.white,
                        fontSize: 11),
                  ),
                ),
                new Tab(
                  icon: Icon(Icons.loyalty,
                      color: _controller.index == 1
                          ? Colors.yellowAccent
                          : Colors.white),
                  child: Text(
                    'บริการ',
                    style: TextStyle(
                        color: _controller.index == 1
                            ? Colors.yellowAccent
                            : Colors.white,
                        fontSize: 11),
                  ),
                ),
                new Tab(
                  icon: Icon(Icons.star,
                      color: _controller.index == 2
                          ? Colors.yellowAccent
                          : Colors.white),
                  child: Text(
                    'รีวิว',
                    style: TextStyle(
                        color: _controller.index == 2
                            ? Colors.yellowAccent
                            : Colors.white,
                        fontSize: 11),
                  ),
                ),
                Container(
                    width: 200,
                    child: Tab(
                      icon: Icon(Icons.pin_drop,
                          color: _controller.index == 3
                              ? Colors.yellowAccent
                              : Colors.white),
                      child: Text(
                        'สถานที่ใกล้เคียง',
                        maxLines: 1,
                        style: TextStyle(
                            color: _controller.index == 3
                                ? Colors.yellowAccent
                                : Colors.white,
                            fontSize: 9),
                      ),
                    ))
              ],
            ),
          ),


          new Container(
            height: double.maxFinite,
            child: new TabBarView(
              controller: _controller,
              children: <Widget>[
                Container(
                  color: Colors.deepPurpleAccent,
                  height: 50,
                  // child: getlist(),
                  //width: 20,
                ),
                
                Column(
                  children: <Widget>[
                    Container(
                      color: Colors.white,
                      height: 120,
                      child: Wrap(
                        alignment: WrapAlignment.start,
                        spacing: 10.0, // gap between adjacent chips
                        runSpacing: 5.0, // gap between lines
                        children: <Widget>[
                          FilterChip(
                            label: Text(
                              "ทั้งหมด (10)",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: SizeConfig.getFontSize(15),
                                  fontFamily: "SF_Pro_Text",
                                  fontWeight: FontWeight.w500),
                            ),
                            backgroundColor: Color.fromRGBO(106, 179, 170, 1),
                            shape: StadiumBorder(
                              side: BorderSide(color: Colors.white),
                            ),
                            onSelected: (bool value) {
                              print("selected");
                              setState(() {});
                            },
                          ),
                          FilterChip(
                            label: Text(
                              "ที่เที่ยว (5)",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: SizeConfig.getFontSize(15),
                                  fontFamily: "SF_Pro_Text",
                                  fontWeight: FontWeight.w500),
                            ),
                            backgroundColor: Color.fromRGBO(106, 179, 170, 1),
                            shape: StadiumBorder(
                              side: BorderSide(color: Colors.white),
                            ),
                            onSelected: (bool value) {
                              print("selected");
                            },
                          ),
                          FilterChip(
                            label: Text(
                              "ที่กิน (3)",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: SizeConfig.getFontSize(15),
                                  fontFamily: "SF_Pro_Text",
                                  fontWeight: FontWeight.w500),
                            ),
                            backgroundColor: Color.fromRGBO(106, 179, 170, 1),
                            shape: StadiumBorder(
                              side: BorderSide(color: Colors.white),
                            ),
                            onSelected: (bool value) {
                              print("selected");
                            },
                          ),
                          FilterChip(
                            label: Text(
                              "ที่พัก (1)",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontFamily: "SF_Pro_Text",
                                  fontWeight: FontWeight.w500),
                            ),
                            backgroundColor: Color.fromRGBO(106, 179, 170, 1),
                            shape: StadiumBorder(
                              side: BorderSide(color: Colors.white),
                            ),
                            onSelected: (bool value) {
                              print("selected");
                            },
                          ),
                          FilterChip(
                            label: Text(
                              "กิจกรรม (1)",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontSize: SizeConfig.getFontSize(15),
                                  fontFamily: "SF_Pro_Text",
                                  fontWeight: FontWeight.w500),
                            ),
                            backgroundColor: Color.fromRGBO(106, 179, 170, 1),
                            shape: StadiumBorder(
                              side: BorderSide(color: Colors.white),
                            ),
                            onSelected: (bool value) {
                              print("selected");
                            },
                          ),
                        ],
                      ),
                    ),
                    Container(
//                      color: Colors.blue,
                      height: double.maxFinite,
                      child: ShopServicePage(),
                    ),
                  ],
                ),
                // child: getlist(),
                //width: 20,

                Container(
//                  color: Colors.red,
                  child: ShopReviewsPage(),
                  // child: getlist(),
                  //width: 20,
                ),
//
              Container(
//                width: double.maxFinite,
//                color: Colors.yellow,
//              child: setupView(),
               child: ShopNearbyPlacesPage(),
              ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
