SHARE
TWEET

Untitled

a guest Oct 10th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2. import 'package:provider/provider.dart';
  3. import 'package:stayon/modules/offer/offers_bloc.dart';
  4. import 'package:stayon/modules/offer/widgets/offers_available.dart';
  5. import 'package:stayon/modules/offer/widgets/vouchers_accepted.dart';
  6. import 'package:stayon/shared/models/skin_partner_model.dart';
  7. import 'package:stayon/shared/models/voucher_model.dart';
  8.  
  9. class OffersPage extends StatefulWidget {
  10.   @override
  11.   _OffersPageState createState() => _OffersPageState();
  12. }
  13.  
  14. class _OffersPageState extends State<OffersPage> {
  15.   final SkinPartnerModel skinModel = SkinPartnerModel();
  16.  
  17.   final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey(debugLabel: "Offer");
  18.  
  19.   List<VoucherModel> vouchers = List();
  20.  
  21.   OffersBloc bloc;
  22.  
  23.   @override
  24.   void didChangeDependencies() {
  25.     bloc = Provider.of<OffersBloc>(context);
  26.     bloc.syncOffers();
  27.     bloc.syncVouchers();
  28.     super.didChangeDependencies();
  29.   }
  30.  
  31.   @override
  32.   Widget build(BuildContext context) {
  33.     return Scaffold(
  34.       key: scaffoldKey,
  35.       body: DefaultTabController(
  36.         length: 2,
  37.         child: Scaffold(
  38.           appBar: AppBar(
  39.             bottom: TabBar(
  40.               indicatorColor:
  41.                   Color(int.parse(skinModel.skinInfo.color.bgVoucher[1])),
  42.               tabs: <Widget>[
  43.                 Padding(
  44.                   padding: EdgeInsets.fromLTRB(0, 0, 0, 10),
  45.                   child: Text('DisponĂ­veis',
  46.                       style:
  47.                           TextStyle(fontSize: 18, fontWeight: FontWeight.w300)),
  48.                 ),
  49.                 Padding(
  50.                   padding: EdgeInsets.fromLTRB(0, 0, 0, 10),
  51.                   child: Text('Aceitas',
  52.                       style:
  53.                           TextStyle(fontSize: 18, fontWeight: FontWeight.w300)),
  54.                 ),
  55.               ],
  56.             ),
  57.             title: Row(children: <Widget>[
  58.               Icon(Icons.local_offer),
  59.               Padding(
  60.                   padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
  61.                   child: Text('Ofertas'))
  62.             ]),
  63.             backgroundColor:
  64.                 Color(int.parse(skinModel.skinInfo.color.bgVoucher[2])),
  65.           ),
  66.           body: TabBarView(
  67.             children: <Widget>[
  68.               Consumer<OffersBloc>(
  69.                 builder: (context, bloc, widget) => widget,
  70.                 child: OffersAvailableWidget(
  71.                                 bloc.offers.reversed.toList()),
  72.               ),
  73.               Consumer<OffersBloc>(
  74.                 builder: (context, bloc, widget) => widget,
  75.                 child: VouchersAcceptedeWidget(
  76.                                 bloc.vouchers.reversed.toList()),
  77.               ),
  78.             ],
  79.           ),
  80.         ),
  81.       ),
  82.     );
  83.   }
  84. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top