Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:geolocator/geolocator.dart';
- import 'package:gogiver/Config/UiData.dart';
- import 'package:gogiver/DAL/ParceiraDao.dart';
- import 'package:gogiver/DAL/ParceiraPorCategoriaDao.dart';
- import 'package:gogiver/Telas/MarcaSingle.dart';
- import 'package:gogiver/Telas/Marcas.dart';
- import 'package:gogiver/Telas/Parceira.dart';
- import 'package:http/http.dart' as http;
- class Destaque extends StatefulWidget {
- @override
- _DestaqueState createState() => _DestaqueState();
- }
- class _DestaqueState extends State<Destaque> {Container myArticles(String imageVal, String heading, String subHeading) {
- return Container(
- width: 250.0,
- child: Card(
- child: Wrap(
- children: <Widget>[
- Stack(
- children: <Widget>[
- Positioned(
- child: Image.network(imageVal),
- ),
- Positioned(
- top: 15,
- left: 15,
- child: Container(
- alignment: Alignment.center,
- height: 55,
- width: 55,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- width: 2,
- color: Colors.white,
- ),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- "20%",
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- Text(
- 'Off',
- style: TextStyle(
- color: Colors.white,
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Wanna Class",
- style: TextStyle(
- fontSize: 20,
- color: Color(0xff322F36),
- fontWeight: FontWeight.bold),
- )),
- Padding(
- padding: EdgeInsets.all(10),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.place,
- ),
- Text("500 m"),
- ],
- )),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(left: 5, bottom: 5),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.dashboard,
- color: Color(0xff3E3840),
- ),
- Text(
- "Curso",
- style: TextStyle(
- color: Color(0xff3E3840),
- ),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Row(
- children: <Widget>[
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Text(
- "4.7",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "200 avaliaçôes |",
- style: TextStyle(color: Colors.black.withOpacity(0.3)),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "Aberto",
- style: TextStyle(
- color: Colors.lightGreen,
- ),
- ),
- ),
- ],
- ),
- ),
- Center(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Ofertas Online",
- style: TextStyle(color: Colors.black.withOpacity(0.7)),
- ),
- ),
- ),
- Center(
- child: Container(
- padding: EdgeInsets.all(10),
- width: 200,
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Padding(
- padding: EdgeInsets.all(0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Text(
- "PEGAR CUPON",
- style: TextStyle(color: Colors.white),
- ),
- Icon(
- Icons.local_offer,
- color: Colors.white,
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- Container mySingleArticles(String imageVal, String heading, String subHeading) {
- return Container(
- height: 450,
- child: Card(
- child: Wrap(
- children: <Widget>[
- Stack(
- children: <Widget>[
- Positioned(
- child: GestureDetector(
- onTap: () {
- Navigator.push(context,
- MaterialPageRoute(builder: (context) => Parceira(1)));
- },
- child: Image.network(imageVal),
- ),
- ),
- Positioned(
- top: 15,
- left: 15,
- child: Container(
- alignment: Alignment.center,
- height: 55,
- width: 55,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- width: 2,
- color: Colors.white,
- ),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- "20%",
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- Text(
- 'Off',
- style: TextStyle(
- color: Colors.white,
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Wanna Class",
- style: TextStyle(
- fontSize: 20,
- color: Color(0xff322F36),
- fontWeight: FontWeight.bold),
- )),
- Padding(
- padding: EdgeInsets.all(10),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.place,
- ),
- Text("500 m"),
- ],
- )),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(left: 5, bottom: 5),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.dashboard,
- color: Color(0xff3E3840),
- ),
- Text(
- "Curso",
- style: TextStyle(
- color: Color(0xff3E3840),
- ),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Row(
- children: <Widget>[
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Text(
- "4.7",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "200 avaliaçôes |",
- style: TextStyle(color: Colors.black.withOpacity(0.3)),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "Aberto",
- style: TextStyle(
- color: Colors.lightGreen,
- ),
- ),
- ),
- ],
- ),
- ),
- Center(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Ofertas Online",
- style: TextStyle(color: Colors.black.withOpacity(0.7)),
- ),
- ),
- ),
- Center(
- child: Container(
- padding: EdgeInsets.all(10),
- width: 200,
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Padding(
- padding: EdgeInsets.all(0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Text(
- "PEGAR CUPON",
- style: TextStyle(color: Colors.white),
- ),
- Icon(
- Icons.local_offer,
- color: Colors.white,
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- _coordernadasDistancia() async {
- //-22.744061, -42.862394
- //-22.745119, -42.859079
- double distanceInMeters = await Geolocator()
- .distanceBetween(-22.744061, -42.862394, -22.745119, -42.859079);
- return distanceInMeters.toStringAsPrecision(3);
- }
- _listarMatrizPageSize() {
- ParceiraPorCategoriaDao listarMatrizPage = ParceiraPorCategoriaDao();
- return listarMatrizPage.listarMatrizesPageSize(http.Client());
- }
- _listarParceirasDestaque() {
- ParceiraDao pDestaque = ParceiraDao();
- return pDestaque.destaque(http.Client());
- }
- _listarTopXUltimosCadastrados() {
- ParceiraPorCategoriaDao topUltimos = ParceiraPorCategoriaDao();
- return topUltimos.listarTopXUltimosCadastrados(http.Client());
- }
- @override
- Widget build(BuildContext context) {
- return ListView(
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 5, top: 15, bottom: 20),
- child: Text(UiData.cardMarca),
- ),
- _listarPorPatrocinadora(),
- Padding(
- padding: EdgeInsets.only(left: 5, top: 15),
- child: Text(UiData.cardPerto),
- ),
- Container(
- height: 450,
- color: Colors.white,
- child: Container(
- margin: EdgeInsets.symmetric(vertical: 10.0),
- child: FutureBuilder(
- future: _listarParceirasDestaque(),
- builder: (context, snapshot) {
- switch (snapshot.connectionState) {
- case ConnectionState.none:
- case ConnectionState.waiting:
- return Center(
- child: CircularProgressIndicator(),
- );
- break;
- case ConnectionState.active:
- case ConnectionState.done:
- if (snapshot.data == null) {
- return Center(
- child: Text("Nenhum resultado encontrado"),
- );
- }
- if (snapshot.hasError) {
- return Center(
- child: Text("Nenhum resultado encontrado"),
- );
- }
- return ListView.builder(
- scrollDirection: Axis.horizontal,
- itemCount: snapshot.data.length,
- itemBuilder: (context, index) {
- return Container(
- height: 90,
- width: 260,
- child: Card(
- child: Wrap(
- children: <Widget>[
- Stack(
- children: <Widget>[
- Positioned(
- child: GestureDetector(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- Parceira(snapshot
- .data[index]
- .id)));
- },
- child: Image.network(
- snapshot.data[index].logo),
- ),
- ),
- Positioned(
- top: 15,
- left: 15,
- child: Container(
- alignment: Alignment.center,
- height: 55,
- width: 55,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- width: 2,
- color: Colors.white,
- ),
- ),
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment.center,
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- "20%",
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- Text(
- 'Off',
- style: TextStyle(
- color: Colors.white,
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- new Flexible(
- child: new Container(
- padding: new EdgeInsets.only(
- right: 13.0),
- child: Padding(
- padding: EdgeInsets.only(
- top: 10,
- left: 10,
- bottom: 10),
- child: new Text(
- snapshot.data[index].nome,
- maxLines: 1,
- softWrap: false,
- overflow: TextOverflow.ellipsis,
- style: new TextStyle(
- fontSize: 16.0,
- fontFamily: 'Roboto',
- color: new Color(0xFF212121),
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- ),
- ),
- Padding(
- padding: EdgeInsets.all(10),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.place,
- ),
- Text("500 m"),
- ],
- )),
- ],
- ),
- Padding(
- padding:
- EdgeInsets.only(left: 5, bottom: 5),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.dashboard,
- color: Color(0xff3E3840),
- ),
- Text(
- "Curso",
- style: TextStyle(
- color: Color(0xff3E3840),
- ),
- )
- ],
- ),
- ),
- Center(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Ofertas Online",
- style: TextStyle(
- color: Colors.black
- .withOpacity(0.7)),
- ),
- ),
- ),
- Center(
- child: Container(
- padding: EdgeInsets.all(10),
- width: 200,
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0))),
- child: Padding(
- padding: EdgeInsets.all(0),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: <Widget>[
- Text(
- "PEGAR CUPON",
- style: TextStyle(
- color: Colors.white),
- ),
- Icon(
- Icons.local_offer,
- color: Colors.white,
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- });
- break;
- }
- }),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5, top: 15),
- child: Text(UiData.cardnew),
- ),
- Container(
- height: 410,
- child: Container(
- margin: EdgeInsets.symmetric(vertical: 20.0),
- height: 300,
- child:
- ListView(scrollDirection: Axis.horizontal, children: <Widget>[
- myArticles(
- "https://picsum.photos/id/30/300/200", "teste", "SubTitle"),
- myArticles(
- "https://picsum.photos/id/10/300/200", "teste", "SubTitle"),
- myArticles(
- "https://picsum.photos/id/60/300/200", "teste", "SubTitle"),
- myArticles(
- "https://picsum.photos/id/40/300/200", "teste", "SubTitle"),
- ]),
- ),
- ),
- _listarTopXMaisVisitados(),
- ],
- );
- }
- //CHAMADA DAS FETURE NOS ENDPOINTS
- Widget _listarPorPatrocinadora() {
- return Container(
- height: 90,
- color: Colors.white,
- child: Row(
- children: <Widget>[
- Expanded(
- child: Container(
- margin: EdgeInsets.symmetric(vertical: 10.0),
- child: FutureBuilder(
- future: _listarMatrizPageSize(),
- builder: (context, snapshot) {
- switch (snapshot.connectionState) {
- case ConnectionState.none:
- case ConnectionState.waiting:
- return Center(
- child: CircularProgressIndicator(),
- );
- break;
- case ConnectionState.active:
- case ConnectionState.done:
- if (snapshot.data == null) {
- return Center(
- child: Text("Nenhuma Empresa encontrada"),
- );
- }
- return ListView.builder(
- scrollDirection: Axis.horizontal,
- itemCount: snapshot.data.length,
- itemBuilder: (BuildContext context, int index) {
- return _empresas(snapshot.data[index].logo);
- });
- break;
- }
- },
- )),
- ),
- _verLista()
- ],
- ));
- }
- Widget _listarTopXMaisVisitados() {
- return Column(
- children: <Widget>[
- Container(
- height: 1500,
- child: FutureBuilder(
- future: _listarTopXUltimosCadastrados(),
- builder: (context, snapshot){
- switch(snapshot.connectionState){
- case ConnectionState.none:
- case ConnectionState.waiting:
- return Center(
- child: CircularProgressIndicator(),
- );
- break;
- case ConnectionState.active:
- case ConnectionState.done:
- if (snapshot.data == null) {
- return Center(
- child: Text("Nenhuma Empresa encontrada"),
- );
- }
- return Column(
- children: <Widget>[
- Expanded(
- child: ListView.builder(
- physics: NeverScrollableScrollPhysics(),
- itemCount: snapshot.data.length,
- itemBuilder:(BuildContext context, int index){
- return Container(
- height: 450,
- child: Card(
- child: Wrap(
- children: <Widget>[
- Stack(
- children: <Widget>[
- Positioned(
- child: GestureDetector(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => Parceira(1)));
- },
- child: Image.network("https://picsum.photos/id/30/350/234"),
- ),
- ),
- Positioned(
- top: 15,
- left: 15,
- child: Container(
- alignment: Alignment.center,
- height: 55,
- width: 55,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- width: 2,
- color: Colors.white,
- ),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- "20%",
- style: TextStyle(
- color: Colors.white,
- ),
- ),
- Text(
- 'Off',
- style: TextStyle(
- color: Colors.white,
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Wanna Class",
- style: TextStyle(
- fontSize: 20,
- color: Color(0xff322F36),
- fontWeight: FontWeight.bold),
- )),
- Padding(
- padding: EdgeInsets.all(10),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.place,
- ),
- Text("500 m"),
- ],
- )),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(left: 5, bottom: 5),
- child: Row(
- children: <Widget>[
- Icon(
- Icons.dashboard,
- color: Color(0xff3E3840),
- ),
- Text(
- "Curso",
- style: TextStyle(
- color: Color(0xff3E3840),
- ),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Row(
- children: <Widget>[
- Container(
- padding: EdgeInsets.all(3),
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius:
- BorderRadius.all(Radius.circular(5.0))),
- child: Text(
- "4.7",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "200 avaliaçôes |",
- style:
- TextStyle(color: Colors.black.withOpacity(0.3)),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- "Aberto",
- style: TextStyle(
- color: Colors.lightGreen,
- ),
- ),
- ),
- ],
- ),
- ),
- Center(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Text(
- "Ofertas Online",
- style: TextStyle(color: Colors.black.withOpacity(0.7)),
- ),
- ),
- ),
- Center(
- child: Container(
- padding: EdgeInsets.all(10),
- width: 200,
- decoration: BoxDecoration(
- color: Color(0xff362F2F),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Padding(
- padding: EdgeInsets.all(0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Text(
- "PEGAR CUPON",
- style: TextStyle(color: Colors.white),
- ),
- Icon(
- Icons.local_offer,
- color: Colors.white,
- )
- ],
- ),
- ),
- ),
- )
- ],
- ),
- ),
- );
- },
- ),
- )
- ],
- );
- break;
- }
- }
- ),
- )
- ],
- );
- }
- Widget _empresas(img) {
- return Builder(builder: (BuildContext context) {
- return Stack(
- children: <Widget>[
- Positioned(
- child: GestureDetector(
- onTap: () {
- Navigator.push(context,
- MaterialPageRoute(builder: (context) => MarcaSingle()));
- },
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 5),
- child: Image.network(
- img,
- fit: BoxFit.contain,
- width: 70,
- ),
- ),
- ),
- ),
- ],
- );
- });
- }
- Widget _verLista() {
- return Builder(
- builder: (BuildContext context) {
- return GestureDetector(
- onTap: () {
- Navigator.push(
- context, MaterialPageRoute(builder: (context) => Marcas()));
- },
- child: Column(
- children: <Widget>[
- Padding(
- padding: EdgeInsets.all(20),
- child: Text(
- "Ver Todas",
- style: TextStyle(
- color: Colors.blue,
- ),
- ),
- )
- ],
- ),
- );
- },
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement