import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:unit2/bloc/passo/bulding/property_info/property_info_bloc.dart';
import 'package:unit2/bloc/passo/land/land_property_owner_info/land_property_owner_info_bloc.dart';
import 'package:unit2/screens/passo/building_home.dart';
import 'package:unit2/screens/passo/land_home%20.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/widgets/empty_data.dart';

class PassoDashBoard extends StatefulWidget {
  @override
  _PassoDashBoard createState() => _PassoDashBoard();
}

class _PassoDashBoard extends State<PassoDashBoard> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
          body: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return <Widget>[
            new SliverAppBar(
              backgroundColor: primary,
              title: Text('Faas Dashboard'),
              centerTitle: true,
              pinned: true,
              floating: true,
              bottom: TabBar(
                isScrollable: true,
                tabs: [
                  Tab(child: Text('Building')),
                  Tab(child: Text('Land')),
                  Tab(child: Text('Machineries')),
                ],
              ),
            ),
          ];
        },
        body: TabBarView(
          children: <Widget>[
            BlocProvider(
              create: (context) =>
                  PropertyInfoBloc()..add(const LoadPropertyInfo()),
              child: const BuildingHome(),
            ),
            BlocProvider(
              create: (context) =>
                  LandPropertyOwnerInfoBloc()..add(const LoadLand()),
              child: const LandHome(),
            ),
            EmptyData(
              message: "Development ongoing ...",
            )
          ],
        ),
      )),
    );
  }
}
