repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/widgets/loading.dart | import 'package:flutter/material.dart';
class LoadingWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: PreferredSize(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Container(
// padding: EdgeInsets.only(top: 50, right: 20, bottom: 10),
// child: Image.asset("assets/images/logo.png"),
// ),
// ],
),
preferredSize: Size.fromHeight(45)),
body: Center(
child: Container(
height: 60,
margin: EdgeInsets.all(100),
child: Image.asset("assets/images/spinner.gif"),
)));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/widgets/dialog.dart | import 'package:flutter/material.dart';
class Dialogs {
static Future<void> showLoadingDialog(
BuildContext context, {GlobalKey key, String title, String description, String icon, bool barrierDismissible}) async {
return showDialog<void>(
context: context,
barrierDismissible: barrierDismissible,
builder: (BuildContext context) {
return Scaffold(
key: key,
backgroundColor: Colors.transparent,
body: InkWell(
onTap: (){
if(barrierDismissible){
Navigator.of(context).pop();
}else{
return;
}
},
child: Center(
child: Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 20,),
Center(
child: (icon=="success")?
Icon(Icons.check_circle,
color: Colors.green[300],
size: 50,
):
(icon=="failed"?
Icon(Icons.cancel,
color: Colors.red[300],
size: 50,
):
Icon(Icons.info,
color: Colors.blue[300],
size: 50, )
)
),
SizedBox(height: 10,),
Container(
alignment: Alignment.center,
width: double.infinity,
child: Text(title, textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[400]
),
),
),
SizedBox(height: 10,),
Container(
alignment: Alignment.center,
width: double.infinity,
child: Text(description, textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[800],
fontSize: 14
),
),
),
SizedBox(height: 40,),
],
),
),
),
)
);
});
}
static Future<bool> confirmDialog(BuildContext context, String message)async{
return await showDialog(context: context, builder: (context) => WillPopScope(
onWillPop: ()async{
return false;
},
child: AlertDialog(
title: Text(message),
actions: <Widget>[
IconButton(
onPressed: (){
Navigator.of(context).pop(false);
},
icon: Icon(Icons.close, color: Colors.red,),
),
IconButton(
onPressed: (){
Navigator.of(context).pop(true);
},
icon: Icon(Icons.check, color: Colors.green,),
)
],
),
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/trailer.dart | class Trailer {
int id;
bool firmayaAit;
String plakaNo;
String plaka;
String ulke;
Trailer(
{this.id,
this.firmayaAit,
this.plakaNo,
this.plaka,
this.ulke});
Trailer.fromJson(Map<String, dynamic> json) {
id = json['id'];
firmayaAit = json['firmayaAit'];
plakaNo = json['plakaNo'];
plaka = json ['plaka'];
ulke = json['ulke'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['firmayaAit'] = this.firmayaAit;
data['plakaNo'] = this.plakaNo;
data['plaka'] = this.plaka;
data['ulke'] = this.ulke;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/wrecker.dart | class Wrecker {
int id;
bool firmayaAit;
String plakaNo;
String plaka;
String ulke;
Wrecker(
{this.id,
this.firmayaAit,
this.plakaNo,
this.plaka,
this.ulke});
Wrecker.fromJson(Map<String, dynamic> json) {
id = json['id'];
firmayaAit = json['firmayaAit'];
plakaNo = json['plakaNo'];
plaka = json['plaka'];
ulke = json['ulke'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['firmayaAit'] = this.firmayaAit;
data['plakaNo'] = this.plakaNo;
data['plaka'] = this.plaka;
data['ulke'] = this.ulke;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/declaration.dart | class Declaration {
String id;
int otoId;
int sirketId;
String tarih;
String firmaAd;
String mrn;
String plaka;
String rotaBilgi;
String ref;
int giris;
String tasiyici;
String ensStatu;
String rejimKodu;
int tasiyiciId;
int firmaId;
String tasimaMod;
String tasimaMod2;
String tasimaModu;
String tasimaModu2;
String duzenliTarih;
String seferBilgi;
String plaka2;
String plaka3;
String konteynerNo;
Declaration(
{this.id,
this.otoId,
this.sirketId,
this.tarih,
this.firmaAd,
this.mrn,
this.plaka,
this.rotaBilgi,
this.ref,
this.giris,
this.tasiyici,
this.ensStatu,
this.rejimKodu,
this.tasiyiciId,
this.firmaId,
this.tasimaMod,
this.tasimaMod2,
this.tasimaModu,
this.tasimaModu2,
this.duzenliTarih,
this.seferBilgi,
this.plaka2,
this.plaka3,
this.konteynerNo});
Declaration.fromJson(Map<String, dynamic> json) {
id = json['id'];
otoId = json['oto_Id'];
sirketId = json['sirket_Id'];
firmaAd = json['firma_Ad'];
mrn = json['mrn'];
plaka = json['plaka'];
rotaBilgi = json['rota_Bilgi'];
ref = json['ref'];
giris = json['giris'];
tasiyici = json['tasiyici'];
ensStatu = json['ensStatu'];
rejimKodu = json['rejimKodu'];
tasiyiciId = json['tasiyiciId'];
firmaId = json['firmaId'];
tasimaMod = json['tasima_Mod'];
tasimaMod2 = json['tasima_Mod2'];
tasimaModu = json['tasima_Modu'];
tasimaModu2 = json['tasima_Modu2'];
duzenliTarih = json['duzenliTarih'];
seferBilgi = json['sefer_Bilgi'];
plaka2 = json['plaka2'];
plaka3 = json['plaka3'];
konteynerNo = json['konteyner_No'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['oto_Id'] = this.otoId;
data['tarih'] = this.tarih;
data['firma_Ad'] = this.firmaAd;
data['mrn'] = this.mrn;
data['plaka'] = this.plaka;
data['rota_Bilgi'] = this.rotaBilgi;
data['ref'] = this.ref;
data['giris'] = this.giris;
data['tasiyici'] = this.tasiyici;
data['ensStatu'] = this.ensStatu;
data['rejimKodu'] = this.rejimKodu;
data['tasiyiciId'] = this.tasiyiciId;
data['firmaId'] = this.firmaId;
data['tasima_Mod'] = this.tasimaMod;
data['tasima_Mod2'] = this.tasimaMod2;
data['tasima_Modu'] = this.tasimaModu;
data['tasima_Modu2'] = this.tasimaModu2;
data['duzenliTarih'] = this.duzenliTarih;
data['sefer_Bilgi'] = this.seferBilgi;
data['plaka2'] = this.plaka2;
data['plaka3'] = this.plaka3;
data['konteyner_No'] = this.konteynerNo;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/voyages.dart | class Voyages {
String voyageCode;
String vesselName;
String departureDate;
String arrivalDate;
String departurePort;
String arrivalPort;
String imoNumber;
String departureCountry;
String arrivalCountry;
String flagCountry;
Voyages(
{this.voyageCode,
this.vesselName,
this.departureDate,
this.arrivalDate,
this.departurePort,
this.arrivalPort,
this.imoNumber,
this.departureCountry,
this.arrivalCountry,
this.flagCountry});
Voyages.fromJson(Map<String, dynamic> json) {
voyageCode = json['voyageCode'];
vesselName = json['vesselName'];
departureDate = json['departureDate'].toString().replaceAll(" 00:00:00", "");
arrivalDate = json['arrivalDate'].toString().replaceAll(" 00:00:00", "");
departurePort = json['departurePort'];
arrivalPort = json['arrivalPort'];
imoNumber = json['imoNumber'];
departureCountry = json['departureCountry'];
arrivalCountry = json['arrivalCountry'];
flagCountry = json['flagCountry'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['voyageCode'] = this.voyageCode;
data['vesselName'] = this.vesselName;
data['departureDate'] = this.departureDate;
data['arrivalDate'] = this.arrivalDate;
data['departurePort'] = this.departurePort;
data['arrivalPort'] = this.arrivalPort;
data['imoNumber'] = this.imoNumber;
data['departureCountry'] = this.departureCountry;
data['arrivalCountry'] = this.arrivalCountry;
data['flagCountry'] = this.flagCountry;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/add_declaration_model.dart | class AddDeclarationModel {
int sirketId;
String gumruk;
String ihracatci;
String ithalatci;
String cikisUlkesi;
String varisUlkesi;
String beyanSahibi;
String giris;
String rejimKodu;
String tRVarisGumruk;
String yuklemeYer;
String bosaltmaYer;
String ilKREF;
//String ref;
String esyaYeri;
AddDeclarationModel(
{this.sirketId,
this.gumruk,
this.ihracatci,
this.ithalatci,
this.cikisUlkesi,
this.varisUlkesi,
this.beyanSahibi,
this.giris,
this.rejimKodu,
this.tRVarisGumruk,
this.yuklemeYer,
this.bosaltmaYer,
this.ilKREF,
//this.ref,
this.esyaYeri});
AddDeclarationModel.fromJson(Map<String, dynamic> json) {
sirketId = json['sirket_Id'];
gumruk = json['gumruk'];
ihracatci = json['ihracatci'];
ithalatci = json['ithalatci'];
cikisUlkesi = json['cikisUlkesi'];
varisUlkesi = json['varisUlkesi'];
beyanSahibi = json['beyanSahibi'];
giris = json['giris'];
rejimKodu = json['rejimKodu'];
tRVarisGumruk = json['tR_VarisGumruk'];
yuklemeYer = json['yuklemeYer'];
bosaltmaYer = json['bosaltmaYer'];
ilKREF = json['ilK_REF'];
//ref = json['REF'];
esyaYeri = json['esyaYeri'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['sirket_Id'] = this.sirketId;
data['gumruk'] = this.gumruk;
data['ihracatci'] = this.ihracatci;
data['ithalatci'] = this.ithalatci;
data['cikisUlkesi'] = this.cikisUlkesi;
data['varisUlkesi'] = this.varisUlkesi;
data['beyanSahibi'] = this.beyanSahibi;
data['giris'] = this.giris;
data['rejimKodu'] = this.rejimKodu;
data['tR_VarisGumruk'] = this.tRVarisGumruk;
data['yuklemeYer'] = this.yuklemeYer;
data['bosaltmaYer'] = this.bosaltmaYer;
data['ilK_REF'] = this.ilKREF;
//data['ref'] = this.ref;
data['esyaYeri'] = this.esyaYeri;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/positionDetails.dart | class PositionDetails {
int id;
String hareketGumrugu;
String transitinSonGumrugu;
String hareketUlkesi;
String gidecegiUlke;
String gonderici;
String gondericiAdres;
String alici;
String aliciAdres;
String rotalar;
String trnGumrukler;
PositionDetails(
{this.id,
this.hareketGumrugu,
this.transitinSonGumrugu,
this.hareketUlkesi,
this.gidecegiUlke,
this.gonderici,
this.gondericiAdres,
this.alici,
this.aliciAdres,
this.rotalar,
this.trnGumrukler});
PositionDetails.fromJson(Map<String, dynamic> json) {
id = json['id'];
hareketGumrugu = json['hareketGumrugu'];
transitinSonGumrugu = json['transitinSonGumrugu'];
hareketUlkesi = json['hareketUlkesi'];
gidecegiUlke = json['gidecegiUlke'];
gonderici = json['gonderici'];
gondericiAdres = json['gonderici_Adres'];
alici = json['alici'];
aliciAdres = json['alici_Adres'];
rotalar = json['rotalar'];
trnGumrukler = json['trn_Gumrukler'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['hareketGumrugu'] = this.hareketGumrugu;
data['transitinSonGumrugu'] = this.transitinSonGumrugu;
data['hareketUlkesi'] = this.hareketUlkesi;
data['gidecegiUlke'] = this.gidecegiUlke;
data['gonderici'] = this.gonderici;
data['gonderici_Adres'] = this.gondericiAdres;
data['alici'] = this.alici;
data['alici_Adres'] = this.aliciAdres;
data['rotalar'] = this.rotalar;
data['trn_Gumrukler'] = this.trnGumrukler;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/user.dart | class User {
int id;
String adiSoyadi;
String username;
int yetkiDuzeyi;
String email;
bool superUser;
int sirketId;
String ticaretUnvani;
String sessionId;
String token;
int firmaId;
User(
{this.id,
this.adiSoyadi,
this.username,
this.yetkiDuzeyi,
this.email,
this.superUser,
this.sirketId,
this.ticaretUnvani,
this.sessionId,
this.token,
this.firmaId
});
User.fromJson(Map<String, dynamic> json) {
id = json['id'];
adiSoyadi = json['adi_soyadi'];
username = json['username'];
yetkiDuzeyi = json['yetki_duzeyi'];
email = json['email'];
superUser = json['super_user'];
sirketId = json['sirket_id'];
ticaretUnvani = json['ticaret_unvani'];
sessionId = json['session_id'];
token = json['token'];
firmaId = json['firma_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['adi_soyadi'] = this.adiSoyadi;
data['username'] = this.username;
data['yetki_duzeyi'] = this.yetkiDuzeyi;
data['email'] = this.email;
data['super_user'] = this.superUser;
data['sirket_id'] = this.sirketId;
data['ticaret_unvani'] = this.ticaretUnvani;
data['session_id'] = this.sessionId;
data['token'] = this.token;
data['firma_id'] = this.firmaId;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/rcode.dart | import 'dart:convert';
class RCode {
String name;
RCode(
{this.name});
RCode.fromJson(Map<String, dynamic> json) {
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/products.dart | class Products {
int id;
String gtip;
String tanim;
String kapTipi;
int kapAdet;
double brut;
double net;
double tutar;
String doviz;
String parcali;
String gtipNokta;
Products(
{this.id,
this.gtip,
this.tanim,
this.kapTipi,
this.kapAdet,
this.brut,
this.net,
this.tutar,
this.doviz,
this.gtipNokta,
this.parcali});
Products.fromJson(Map<String, dynamic> json) {
id = json['id'];
gtip = json['gtip'];
tanim = json['tanim'];
kapTipi = json['kapTipi'];
kapAdet = json['kapAdet'];
brut = json['brut'] * 1.0;
net = json['net'] * 1.0;
tutar = json['tutar'] * 1.0;
doviz = json['doviz'];
parcali = json['parcali'];
gtipNokta = json['gtipNokta'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['gtip'] = this.gtip;
data['tanim'] = this.tanim;
data['kapTipi'] = this.kapTipi;
data['kapAdet'] = this.kapAdet;
data['brut'] = this.brut;
data['net'] = this.net;
data['tutar'] = this.tutar;
data['doviz'] = this.doviz;
data['parcali'] = this.parcali;
data['gtipNokta'] = this.gtipNokta;
return data;
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/company.dart | class Company {
int id;
int sirketId;
String vergiNo;
String unvan;
String eoriNo;
String adres;
String ilIlce;
String postaKodu;
String tel1;
String eMail;
String ulkeKodu;
Company(
{this.id,
this.sirketId,
this.vergiNo,
this.unvan,
this.eoriNo,
this.adres,
this.ilIlce,
this.postaKodu,
this.tel1,
this.eMail,
this.ulkeKodu});
Company.fromJson(Map<String, dynamic> json) {
id = json['id'];
sirketId = json['sirketId'];
vergiNo = json['vergiNo'];
unvan = json['unvan'];
eoriNo = json['eoriNo'];
adres = json['adres'];
ilIlce = json['ilIlce'];
postaKodu = json['postaKodu'];
tel1 = json['tel1'];
eMail = json['eMail'];
ulkeKodu = json['ulkeKodu'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['sirketId'] = this.sirketId;
data['vergiNo'] = this.vergiNo;
data['unvan'] = this.unvan;
data['eoriNo'] = this.eoriNo;
data['adres'] = this.adres;
data['ilIlce'] = this.ilIlce;
data['postaKodu'] = this.postaKodu;
data['tel1'] = this.tel1;
data['eMail'] = this.eMail;
data['ulkeKodu'] = this.ulkeKodu;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/model/TRNItem.dart | class TRNItem {
int id;
String ref;
String durum;
String hareketGumruk;
String varisGumruk;
String mrn;
String lrn;
String tescilTarihi;
String gonderici;
String gondericiAdres;
String alici;
String aliciAdres;
double teminatBedeli;
double malDegeri;
TRNItem(
{this.id,
this.ref,
this.durum,
this.hareketGumruk,
this.varisGumruk,
this.mrn,
this.lrn,
this.tescilTarihi,
this.gonderici,
this.gondericiAdres,
this.alici,
this.aliciAdres,
this.teminatBedeli,
this.malDegeri});
TRNItem.fromJson(Map<String, dynamic> json) {
id = json['id'];
ref = json['ref'];
durum = json['durum'];
hareketGumruk = json['hareketGumruk'];
varisGumruk = json['varisGumruk'];
mrn = json['mrn'];
lrn = json['lrn'];
tescilTarihi = json['tescilTarihi'];
gonderici = json['gonderici'];
gondericiAdres = json['gonderi_Adres'];
alici = json['alici'];
aliciAdres = json['alici_Adres'];
teminatBedeli = json['teminatBedeli'];
malDegeri = json['malDegeri'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['ref'] = this.ref;
data['durum'] = this.durum;
data['hareketGumruk'] = this.hareketGumruk;
data['varisGumruk'] = this.varisGumruk;
data['mrn'] = this.mrn;
data['lrn'] = this.lrn;
data['tescilTarihi'] = this.tescilTarihi;
data['gonderici'] = this.gonderici;
data['gonderici_Adres'] = this.gondericiAdres;
data['alici'] = this.alici;
data['alici_Adres'] = this.aliciAdres;
data['teminatBedeli'] = this.teminatBedeli;
data['malDegeri'] = this.malDegeri;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/model | mirrored_repositories/flutter-delivery-mvp/lib/model/newdeclaration/customs.dart | class Customs {
String id;
String gumruk;
String ulkeKodu;
String gumrukTamTanim;
Customs({this.id, this.gumruk, this.ulkeKodu, this.gumrukTamTanim});
Customs.fromJson(Map<String, dynamic> json) {
id = json['id'];
gumruk = json['gumruk'];
ulkeKodu = json['ulkeKodu'];
gumrukTamTanim = json['gumrukTamTanim'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['gumruk'] = this.gumruk;
data['ulkeKodu'] = this.ulkeKodu;
data['gumrukTamTanim'] = this.gumrukTamTanim;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/model | mirrored_repositories/flutter-delivery-mvp/lib/model/newdeclaration/firms.dart | class Firms {
int id;
String unvan;
String gunvan;
String adres;
Firms({this.id, this.unvan, this.gunvan, this.adres});
Firms.fromJson(Map<String, dynamic> json) {
id = json['id'];
unvan = json['unvan'];
gunvan = json['gunvan'];
adres = json['adres'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['unvan'] = this.unvan;
data['gunvan'] = this.gunvan;
data['adres'] = this.adres;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/model | mirrored_repositories/flutter-delivery-mvp/lib/model/newdeclaration/countries.dart | class Counties {
String id;
String tanim;
String ulkeTamTanim;
Counties({this.id, this.tanim, this.ulkeTamTanim});
Counties.fromJson(Map<String, dynamic> json) {
id = json['id'];
tanim = json['tanim'];
ulkeTamTanim = json['ulkeTamTanim'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['tanim'] = this.tanim;
data['ulkeTamTanim'] = this.ulkeTamTanim;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/model | mirrored_repositories/flutter-delivery-mvp/lib/model/newproduct/gtip_model.dart | class GtipNo {
int id;
String gtip;
String fGtip;
String tanimTr;
double vergiOrani;
GtipNo({this.id, this.gtip, this.fGtip, this.tanimTr, this.vergiOrani});
GtipNo.fromJson(Map<String, dynamic> json) {
id = json['id'];
gtip = json['gtip'];
fGtip = json['fGtip'];
tanimTr = json['tanim_Tr'];
vergiOrani = json['vergi_Orani']*1.0;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['gtip'] = this.gtip;
data['fGtip'] = this.fGtip;
data['tanim_Tr'] = this.tanimTr;
data['vergi_Orani'] = this.vergiOrani;
return data;
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/controller/apiHelper.dart | import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:tobbund/repository/UserRepository.dart';
import 'connectivity_provider.dart';
import 'dart:convert';
import 'dart:async';
const base_url = "http://176.235.91.74:6245";
//const base_url = "http://192.168.21.150:6245";
//const base_url = "http://testmobil.ncts.com.tr:6245";
//api helper
class ApiHelper {
//get method
Future<Map> doGetRequest(String endPoint) async {
await ConnectivityProvider().connectionListen();
String url = "http://176.235.91.74:6245";
//String url = "http://192.168.21.150:6245";
// String url = "http://testmobil.ncts.com.tr:6245";
print(url);
var response = await http.get(url);
return json.decode(response.body);
}
//post method
Future<Map> doBodyPostRequest(String endPoint, Map params) async {
await ConnectivityProvider().connectionListen();
HttpClient client = new HttpClient();
client.badCertificateCallback =
((X509Certificate cert, String host, int port) => true);
String body = json.encode(params);
String url;
url = "$base_url/$endPoint";
print(url);
print(body);
try {
HttpClientRequest request = await client.postUrl(Uri.parse(url));
request.headers.set('content-type', 'application/json');
if (UserRepository().user?.token != null)
request.headers
.set('Authorization', 'Bearer ${UserRepository().user.token}');
if (body != "null") {
request.add(utf8.encode(body));
}
HttpClientResponse response = await request.close();
String reply = await response.transform(utf8.decoder).join();
return json.decode(reply);
} catch (e) {
print(e.toString());
return {"status": "failed"};
}
}
Future<List> doListPostRequest(String endPoint, Map params) async {
await ConnectivityProvider().connectionListen();
HttpClient client = new HttpClient();
client.badCertificateCallback =
((X509Certificate cert, String host, int port) => true);
String body = json.encode(params);
String url;
url = "$base_url/$endPoint";
print(url);
print(body);
try {
HttpClientRequest request = await client.postUrl(Uri.parse(url));
request.headers.set('content-type', 'application/json');
if (UserRepository().user?.token != null)
request.headers
.set('Authorization', 'Bearer ${UserRepository().user.token}');
if (body != "null") {
request.add(utf8.encode(body));
}
HttpClientResponse response = await request.close();
String reply = await response.transform(utf8.decoder).join();
print(reply);
return json.decode(reply);
} catch (e) {
print(e.toString());
return [];
}
}
}
//import 'package:http/http.dart' as http;
//import 'dart:convert';
//import 'dart:async';
//
////api helper
//class ApiHelper {
//
// //get method
// Future<Map> doGetRequest(String endPoint) async {
// String url = "https://192.168.21.211:5010/";
// print(url);
// var response = await http.get(url);
// return json.decode(response.body);
// }
//
// //post method
// Future<Map> doBodyPostRequest(String endPoint, Map params) async {
// String body = json.encode(params);
// String url;
// url = "https://192.168.21.211:5010/$endPoint";
// print(url);
// print(body);
// try{
// var response = await http.post(url,
// headers: {
// "Content-Type": "application/json"
// },
// body: body,
// );
// return json.decode(response.body);
//
// }catch(e){
// return {
// "status":"failed"
// };
// }
// }
//}
//
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/controller/localAuth.dart | import 'package:shared_preferences/shared_preferences.dart';
import 'package:tobbund/controller/apiHelper.dart';
//local authorization class
class SharedPreferencesUtils{
static SharedPreferences preferences;
SharedPreferencesUtils(SharedPreferences pref) {
preferences = pref;
}
static Future<SharedPreferencesUtils> getInstance() async {
preferences = await SharedPreferences.getInstance();
return new SharedPreferencesUtils(preferences);
}
// Future<User> getLoginInfo() async {
// Map<String, dynamic> map;
// map = json.decode(await preferences.getString("userInfo"));
// return User.fromJson(map);
// }
//session id save when login
void saveLoginInfo(String _sessionId) async {
await preferences.setString('sessionId', _sessionId);
}
//session id
Future<String> getLodinInfo() async {
return preferences.getString('sessionId');
}
//logout
Future<bool> logoout()async{
String _seesionId = await getLodinInfo();
String _endPoint = "logout/$_seesionId";
Map<String, String> _params;
var response = await ApiHelper().doBodyPostRequest(_endPoint, _params);
if(response['error'] != null){
return false;
}
await preferences.remove("sessionId");
return true;
}
//clear total session
void clearAll() async {
await preferences.clear();
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/controller/new_declerations_provider.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/add_declaration_model.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/newdeclaration/countries.dart';
import 'package:tobbund/model/newdeclaration/customs.dart';
import 'package:tobbund/model/newdeclaration/firms.dart';
import 'package:tobbund/repository/UserRepository.dart';
class NewDeclarationProvider extends ChangeNotifier{
bool _isWorking = false;
set isWorking(bool isWorking){
this._isWorking = isWorking;
}
bool get isWorking => this._isWorking;
int _sekirtId;
set sekirtId(int sekirtId){
this._sekirtId = sekirtId;
}
int get sekirtId => this._sekirtId;
int _currentTabIndex = 0;
set currentTabIndex(int trnNumber){
this._currentTabIndex = trnNumber;
}
int get currentTabIndex => this._currentTabIndex;
String _trnNumber;
set trnNumber(String trnNumber){
this._trnNumber = trnNumber;
}
String get trnNumber => this._trnNumber;
Declaration _declaration;
set declaration(Declaration declaration){
this._declaration = declaration;
}
Declaration get declaration=>this._declaration;
Customs _gumruk;
set gumruk(Customs gumruk){
this._gumruk = gumruk;
}
Customs get gumruk=>this._gumruk;
Counties _ulke;
set ulke(Counties ulke){
this._ulke = ulke;
}
Counties get ulke=>this._ulke;
Firms _gonderici;
set gonderici(Firms gonderici){
this._gonderici = gonderici;
}
Firms get gonderici=>this._gonderici;
Customs _varisGumruk;
set varisGumruk(Customs varisGumruk){
this._varisGumruk = varisGumruk;
}
Customs get varisGumruk=>this._varisGumruk;
Counties _varisUlke;
set varisUlke(Counties varisUlke){
this._varisUlke = varisUlke;
}
Counties get varisUlke=>this._varisUlke;
Firms _alci;
set alci(Firms alci){
this._alci = alci;
}
Firms get alci=>this._alci;
AddDeclarationModel _addDeclarationModel;
init(){
_currentTabIndex = 0;
_trnNumber = null;
_gumruk = null;
_ulke = null;
_gonderici = null;
_varisGumruk = null;
_varisUlke = null;
_alci = null;
_addDeclarationModel = null;
}
Future<int> addDeclaration()async{
if(_isWorking)return 3;
_addDeclarationModel = new AddDeclarationModel(
sirketId: _sekirtId,
gumruk: _gumruk.id,
ihracatci: _gonderici.id.toString(),
ithalatci: _alci.id.toString(),
cikisUlkesi: _gumruk.ulkeKodu,
varisUlkesi: _varisGumruk.ulkeKodu,
beyanSahibi: UserRepository().user.firmaId.toString(),
giris: UserRepository().user.id.toString(),
rejimKodu: _declaration.rejimKodu,
tRVarisGumruk: _varisGumruk.id,
ilKREF: _declaration.ref,
//ref: _declaration.ref,
yuklemeYer: _gumruk.ulkeKodu,
bosaltmaYer: _varisGumruk.ulkeKodu,
);
print(_addDeclarationModel.toJson());
_isWorking = true;
var result = await ApiHelper().doListPostRequest("AddDeclaration", _addDeclarationModel.toJson());
print(result);
_isWorking = false;
if(result.isEmpty){
return 1;
}
_trnNumber = result[0]['ref'];
return 2;
}
bool checkActive(){
if(_gumruk == null || _gonderici == null || _varisGumruk == null || _alci == null){
return false;
}else{
return true;
}
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/controller/connectivity_provider.dart | import 'package:flutter/material.dart';
import 'package:connectivity/connectivity.dart';
import 'package:tobbund/widgets/dialog.dart';
BuildContext dialogcontext;
int i = 0;
class ConnectivityProvider{
Future connectionListen()async{
await Connectivity().checkConnectivity().then((ConnectivityResult result) {
// Got a new connectivity status!
if (result == ConnectivityResult.mobile) {
// I am connected to a mobile network.
} else if (result == ConnectivityResult.wifi) {
// I am connected to a wifi network.
}else{
Dialogs.showLoadingDialog(dialogcontext, title: "Bağlantı Hatası", description: "Lütfen internet bağlantınızı kontrol edin.", icon: 'failed', barrierDismissible: true);
}
});
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebar.dart | import 'package:flutter/material.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'dart:io' show Platform;
class SideBarWidget extends StatelessWidget {
SideBarWidget({this.callback});
final ValueChanged<String> callback;
int logoHeight;
@override
Widget build(BuildContext context) {
Widget _administrativeFunctions() {
if(UserRepository().user.sirketId == 1000){
return InkWell(
onTap: () {
callback("administrativeFunctions");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: CircleAvatar(
radius: 12,
child: Icon( Icons.functions),
backgroundColor: Colors.white,
),
),
// child: Icon(Icons.functions, color: Color(0xFFFFCC00), size: 25,)
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Yönetsel İşlevler",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
);
}else {
return InkWell(
child: Container(),
);
}
}
return Scaffold(
backgroundColor: Color(0xFF00507D),
body: Container(
padding: EdgeInsets.only(left: 10, top: 30),
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
children: <Widget>[
SizedBox(height: 20,),
ListTile(
title: Text(
UserRepository().user.adiSoyadi,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana"
),
),
subtitle: Text(
UserRepository().user.ticaretUnvani,
style: TextStyle(
color: Colors.white,
fontSize: 12,
fontFamily: "Verdana"
),
),
leading: CircleAvatar(
child: Icon(
Icons.account_circle,
),
backgroundColor: Colors.white,
),
),
Divider(
height: 30,
thickness: 2,
color: Colors.white,
indent: 2,
endIndent: 15,
),
//Administrative Functions
_administrativeFunctions(),
//Account
InkWell(
onTap: () {
callback("account");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.account_circle,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Hesabım",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
//declerations list
InkWell(
onTap: () {
callback("registrationProcedures");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.view_list,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Tescil Listesi",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
//new declerations
InkWell(
onTap: () {
callback("newDeclerations");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.edit,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Yeni ENS Beyanı",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
//customer information
InkWell(
onTap: () {
callback("customerInformation");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.people,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Müşteri Bilgileri",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
// help and support
InkWell(
onTap: () {
callback("helpandsupport");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.help,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Yardım ve Destek",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
// reports
InkWell(
onTap: () {
callback("reports");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.report,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Raporlar",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
// SettingScreen-Start //
InkWell(
onTap: () {
callback("settings");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.settings,
color: Colors.white,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Ayarlar",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
// SettingScreen-End //
InkWell(
onTap: () {
callback("logout");
},
child: Container(
padding: EdgeInsets.only(bottom: 10, top: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
child: Icon(
Icons.close,
color: Colors.red,
),
),
Container(
padding: EdgeInsets.only(left: 5),
child: Text(
"Güvenli Çıkış",
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: "Verdana",
fontWeight: FontWeight.w300),
),
),
],
),
),
),
//logo
Container(
height: MediaQuery.of(context).size.height - (Platform.isIOS?170:298),
width: 225,
child: Image.asset("assets/images/logo-tagline-white.png"),
)
],
),
)
),
);
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/screens/bottombar.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/connectivity_provider.dart';
import 'dart:io' show Platform;
import 'package:tobbund/screens/home/declerationsPage.dart';
import 'package:tobbund/screens/home/newDeclerationPage.dart';
import 'package:tobbund/screens/home/customerInformation.dart';
import 'package:tobbund/widgets/dialog.dart';
class BottomBarWidget extends StatelessWidget {
BottomBarWidget({Key key, this.pageIndex}) : super(key: key);
int pageIndex;
@override
Widget build(BuildContext context) {
dialogcontext = context;
return Platform.isIOS
? Container(
height: 65,
color: Color(0xFF007DB9),
alignment: Alignment.center,
padding: EdgeInsets.only(top: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () async{
if (pageIndex != 0)
if(pageIndex == 1)
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Sayfadan çıkmak istediğinize emin misiniz?")) return;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DeclerationsPage()));
},
child: Container(
child: Column(children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/registration.png",
fit: BoxFit.cover,
),
),
Text(
"Tescil Listesi",
style: TextStyle(fontSize: 12, color: Colors.white),
)
])),
),
///////////
InkWell(
onTap: () async{
print("Decleration");
if (pageIndex != 1)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NewDeclerationPage()));
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/decleration.png",
fit: BoxFit.cover,
),
),
Text(
"Yeni Beyan Yaz",
style: TextStyle(fontSize: 12, color: Colors.white),
)
],
)),
),
//////////
InkWell(
onTap: () async{
if (pageIndex != 2)
if(pageIndex == 1)
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Sayfadan çıkmak istediğinize emin misiniz?")) return;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CustomerInformation()));
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/client.png",
fit: BoxFit.cover,
),
),
Text(
"Müşteri Bilgileri",
style: TextStyle(fontSize: 12, color: Colors.white),
)
],
)),
),
//////////
// InkWell(
// onTap: (){},
// child: Container(
// child: Column(
// children: <Widget>[
// Container(
// height: 35,
// child: Image.asset("assets/images/invoice.png",fit: BoxFit.cover,),
// ),
// Text("Fatura Rapor", style: TextStyle(fontSize: 12, color: Colors.white),)
// ],
// )
// ),
// )
],
),
)
: Container(
height: 58,
color: Color(0xFF007DB9),
alignment: Alignment.center,
padding: EdgeInsets.only(top: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () async{
if (pageIndex != 0)
if(pageIndex == 1)
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Sayfadan çıkmak istediğinize emin misiniz?")) return;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DeclerationsPage()));
},
child: Container(
child: Column(children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/registration.png",
fit: BoxFit.cover,
),
),
Text(
"Tescil Listesi",
style: TextStyle(fontSize: 12, color: Colors.white),
)
])),
),
///////////
InkWell(
onTap: () async{
print("Decleration");
if (pageIndex != 1)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NewDeclerationPage()));
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/decleration.png",
fit: BoxFit.cover,
),
),
Text(
"Yeni Beyan Yaz",
style: TextStyle(fontSize: 12, color: Colors.white),
)
],
)),
),
//////////
InkWell(
onTap: () async{
if (pageIndex != 2)
if(pageIndex == 1)
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Sayfadan çıkmak istediğinize emin misiniz?")) return;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CustomerInformation()));
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 35,
child: Image.asset(
"assets/images/client.png",
fit: BoxFit.cover,
),
),
Text(
"Müşteri Bilgileri",
style: TextStyle(fontSize: 12, color: Colors.white),
)
],
)),
),
//////////
// InkWell(
// onTap: (){},
// child: Container(
// child: Column(
// children: <Widget>[
// Container(
// height: 35,
// child: Image.asset("assets/images/invoice.png",fit: BoxFit.cover,),
// ),
// Text("Fatura Rapor", style: TextStyle(fontSize: 12, color: Colors.white),)
// ],
// )
// ),
// )
],
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/screens/splash.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/connectivity_provider.dart';
import 'package:tobbund/screens/login.dart';
import 'dart:async';
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin{
Animation animation, delayedAnimation, muchDelayAnimation, transfor,fadeAnimation;
AnimationController animationController;
@override
void initState(){
super.initState();
animationController = AnimationController(
duration: Duration(milliseconds: 1000), vsync: this);
animation = Tween(begin: 0.0, end: 0.0).animate(CurvedAnimation(
parent: animationController,
curve: Curves.fastOutSlowIn
));
transfor = BorderRadiusTween(
begin: BorderRadius.circular(125.0),
end: BorderRadius.circular(0.0)).animate(
CurvedAnimation(parent: animationController, curve: Curves.ease)
);
fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(animationController);
animationController.forward();
new Timer(new Duration(seconds: 3), ()async{
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>LoginScreen()), (Route<dynamic> route) => false);
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
dialogcontext = context;
return AnimatedBuilder(
animation: animationController,
builder: (BuildContext context, Widget child) {
return Scaffold(
body: new Container(
decoration: new BoxDecoration(color: Color(0xff0D1C3B)),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
// padding: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.2),
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
// padding: EdgeInsets.all(25.0),
child: Image.asset(
"assets/images/logo-tagline-skyblue.png",
width: 450.0,
),
),
// SizedBox(height: 80,),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: <Widget>[
// Text("NCTS", style:
// TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 50,
// ),),
// Container(
// padding: EdgeInsets.only(bottom: 5),
// child: Text("mobil",
// style:
// TextStyle(
// color: Colors.white, fontWeight: FontWeight.w500, fontSize: 35,
// fontFamily: "Helvetica"),),
// ),
// ],
// ),
],
),
),
Container(
child: Column(
children: <Widget>[
// Container(
// child: Image.asset("assets/images/bottomimg.png"),
// ),
SizedBox(height: 30,),
Container(
alignment: Alignment.bottomCenter,
// padding: EdgeInsets.only(bottom: 15),
child: Text("v1.0", style: TextStyle(color: Color(0xff009BD4)),),
),
],
),
),
],
),
),
);
}
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/screens/login.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/connectivity_provider.dart';
import 'package:tobbund/screens/home.dart';
import 'package:tobbund/model/user.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/controller/localAuth.dart';
import 'package:tobbund/screens/home/declerationsPage.dart';
import 'package:tobbund/widgets/loading.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'package:toast/toast.dart';
import 'dart:io';
//login screen
class LoginScreen extends StatefulWidget {
@override
_LoginScreenState createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final _formKey = GlobalKey<FormState>();
final _emailController = new TextEditingController();
final _passwordController = new TextEditingController();
bool _isLoading = false;
// Start //
//email input field
Widget _EmailField() {
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
controller: _emailController,
validator: (value){
String pattern =
r'^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\.[a-zA-Z]+';
RegExp regExp = new RegExp(pattern);
if (value.isEmpty) {
return "E-Posta adresinizi kontrol ediniz.";
} else if (!regExp.hasMatch(value)) {
return "Hatalı E-Posta adresi";
}
return null;
},
decoration: InputDecoration(
hintText: "E - Posta",
hintStyle: TextStyle(
color: Colors.grey[600],
fontFamily: "Verdana",
fontSize: 16,
fontWeight: FontWeight.w500
),
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.grey[400], width: 0.5)),
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.grey[700], width: 0.5)),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.red[400], width: 1)),
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.red[400], width: 0.5)),
fillColor: Colors.white,
filled: true))
],
),
);
}
//password input field
Widget _PasswordField() {
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
controller: _passwordController,
validator: (value){
if(value.isEmpty){
return "Şifre girmeniz gerekiyor.";
}else if(value.length < 6){
return "Hatalı şifre.";
}
return null;
},
obscureText: true,
decoration: InputDecoration(
hintText: "Şifre",
hintStyle: TextStyle(
color: Colors.grey[600],
fontFamily: "Verdana",
fontSize: 16,
fontWeight: FontWeight.w500
),
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.grey[400], width: 0.5)),
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.grey[700], width: 0.5)),
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.red[400], width: 0.5)),
focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(4), borderSide: BorderSide(color: Colors.red[400], width: 1)),
fillColor: Colors.white,
filled: true))
],
),
);
}
// Other Buttons //
Widget _ButtonsField() {
// End //
return Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
height: 35,
width: 100,
child: FlatButton(
color: Color(0xff009BD4),
onPressed: _login,
child: Text("Giriş", style: TextStyle(color: Colors.white, fontFamily: "Verdana"),),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
InkWell(
onTap: (){},
child: Text("Şifre Unuttum?",
style: TextStyle(
color: Color(0xff0D1C3B),
fontSize: 14,
fontFamily: "Verdana"
),
),
),
SizedBox(height: 12,),
InkWell(
onTap: (){},
child: Text("Yeni Üyelik Başvurusu",
style: TextStyle(
color: Color(0xff0D1C3B),
fontSize: 14,
fontFamily: "Verdana"
),
),
)
],
),
],
),
],
),
);
}
@override
void initState() {
_emailController.text = "serkan.erkan@ekol.com.tr";
_passwordController.text = "4442322";
super.initState();
}
@override
Widget build(BuildContext context) {
dialogcontext = context;
return WillPopScope(
onWillPop: (){
exit(1);
return null;
},
child: _isLoading?
LoadingWidget():
Scaffold(
appBar: PreferredSize(child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 150.0),
child: Image.asset(
"assets/images/logo-tagline-skyblue.png",
width: 275.0,
),
),
],
),
preferredSize: Size.fromHeight(1000)
),
body: SingleChildScrollView(
child: Container(
child: Container(
child: Container(
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 25,),
Container(
padding: EdgeInsets.only(left: 20, right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Text("Giriş", style: TextStyle(
// color: Colors.grey[600],
// fontFamily: "Verdana",
// fontSize: 24,
// fontWeight: FontWeight.w500
// ),),
SizedBox(height: 5),
Container(
decoration: BoxDecoration(
color: Color(0xFFFFE496),
border: Border.all(color: Color(0xFFEF9000), width: 0.5),
borderRadius: BorderRadius.circular(10)
),
padding: EdgeInsets.all(20),
child: Column(
children: <Widget>[
// Text("Hoşgeldiniz", style: TextStyle(
// color: Colors.blue[900],
// fontFamily: "Verdana",
// fontSize: 20,
// fontWeight: FontWeight.bold,
// ),
// ),
Text("Giriş", style: TextStyle(
color: Color(0xFF0E1D3A),
fontFamily: "Verdana Bold",
fontSize: 22,
fontWeight: FontWeight.w500
),),
_EmailField(),
_PasswordField(),
_ButtonsField()
],
),
),
],
),
),
],
),
)
),
),
),
)
),
);
}
void _login()async{
FocusScope.of(context).requestFocus(new FocusNode());
// Navigator.push(context, MaterialPageRoute(builder: (context) => HomeScreen()));
if(_formKey.currentState.validate()){
setState(() {
_isLoading = true;
});
Map<String, String> _params = {
"username": _emailController.text,
"password": _passwordController.text
};
String _endPoint = "login";
var response = await ApiHelper().doBodyPostRequest(_endPoint, _params);
print(response);
if(response['status'] != "failed"){
UserRepository().user = User.fromJson(response);
print("sessionId");
String _sessionId = response["session_id"];
SharedPreferencesUtils.getInstance().then((pref){
pref.saveLoginInfo(_sessionId);
});
await Future.delayed(Duration(seconds: 1));
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(
builder: (context) => DeclerationsPage()
), ModalRoute.withName('/'),);
return;
}else{
Toast.show("Hatalı Kullanıcı", context, duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
}
setState(() {
_isLoading = false;
});
}
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib | mirrored_repositories/flutter-delivery-mvp/lib/screens/home.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tobbund/controller/localAuth.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/login.dart';
import 'package:tobbund/screens/sidebarItemScreens/administrativeFunctionsScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/accountScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/registrationProcedures.dart';
import 'package:tobbund/screens/home/customerInformation.dart';
import 'package:tobbund/screens/sidebarItemScreens/helpSupportScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/regulationScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/reportScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/settingScreen.dart';
import 'package:tobbund/screens/sidebar.dart';
import 'package:tobbund/screens/home/newDeclerationPage.dart';
import 'package:tobbund/screens/home/declerationsPage.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';
import 'dart:io' show Platform;
import 'package:charts_flutter/flutter.dart' as charts;
import 'dart:math';
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
List<charts.Series<Declerations, String>> _seriesPieData;
_generateData(){
var pieData=[
new Declerations ('Açık Beyan Sayısı', 120, Color(0xFFFFAB00)),
new Declerations ('Hazırlanan Beyan Sayısı', 130, Color(0xFF12C8F5)),
new Declerations ('Tamamlanmış Beyan Sayısı', 100, Color(0xFF0B1C3A)),
];
_seriesPieData.add(
charts.Series(
data: pieData,
domainFn: (Declerations declerations,_) => declerations.name,
measureFn: (Declerations declerations,_) => declerations.value,
colorFn: (Declerations declerations,_) => charts.ColorUtil.fromDartColor(declerations.colorValue),
id: 'Beyan Sayıları',
labelAccessorFn: (Declerations row,_) => '${row.value}'
)
);
}
pieChart(){
return charts.PieChart(
_seriesPieData,
animate: true,
animationDuration: Duration(seconds: 2),
behaviors: [
new charts.DatumLegend(
outsideJustification: charts.OutsideJustification.middleDrawArea,
horizontalFirst: false,
desiredMaxRows: 5,
// cellPadding: new EdgeInsets.only(right: 4.0, bottom: 4.0),
entryTextStyle: charts.TextStyleSpec(
color: charts.ColorUtil.fromDartColor(Color(0xFF0B1C3A)),
fontFamily: 'Verdana',
fontSize: 14
),
),
],
defaultRenderer: new charts.ArcRendererConfig(
arcWidth: 100,
arcRendererDecorators: [
new charts.ArcLabelDecorator(
labelPosition: charts.ArcLabelPosition.inside
)
]
),
);
}
bool _isLoading = false;
@override
void initState(){
super.initState();
_seriesPieData = List<charts.Series<Declerations, String>>();
_generateData();
}
Widget build(BuildContext context)
{
return InnerDrawer(
key: _innerDrawerKey,
onTapClose: true, // default false
swipe: true, // default true
// colorTransition: Colors.white, // default Color.black54
// DEPRECATED: use offset
leftOffset: 0.6, // Will be removed in 0.6.0 version
rightOffset: 0.6,// Will be removed in 0.6.0 version
//When setting the vertical offset, be sure to use only top or bottom
offset: IDOffset.only(
left: 0.5,
top: 0,
bottom: 0
),
proportionalChildArea : true, // default true
leftAnimationType: InnerDrawerAnimation.static, // default static
rightAnimationType: InnerDrawerAnimation.quadratic,
// backgroundColor: Color(0xFF405161), // default Theme.of(context).backgroundColor
// //when a pointer that is in contact with the screen and moves to the right or left
// onDragUpdate: (double val, InnerDrawerDirection direction) {
//
// },
// innerDrawerCallback: (a) => print(a), // return true (open) or false (close)
leftChild: SideBarWidget(
callback: (val){
_toggle();
switch(val){
case "administrativeFunctions":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => AdministrativeFunctionsScreen()));
break;
case "account":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => AccountScreen()));
break;
case "registrationProcedures":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => DeclerationsPage()));
break;
case "newDeclerations":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => NewDeclerationPage()));
break;
case "customerInformation":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => CustomerInformation()));
break;
case "regulation":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => RegulationScreen()));
break;
case "helpandsupport":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => HelpSupportScreen()));
break;
case "reports":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ReportScreen()));
break;
case "settings":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SettingScreen()));
break;
default:
_logout();
}
},
),
scaffold: Scaffold(
backgroundColor: Colors.white,
appBar: PreferredSize(child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 50, left: 20, bottom: 10
),
child: InkWell(
onTap: (){
_toggle();
},
child: Icon(Icons.menu, color: Colors.red, size: 35,),
),
),
Container(
padding: EdgeInsets.only(
top: 50, right: 20, bottom: 10
),
child: Image.asset(
"assets/images/logo-skyblue.png",
height: 45.0,
),
),
],
), preferredSize: Size.fromHeight(80)),
body: SlidingUpPanel(
// slideDirection: SlideDirection.UP,
renderPanelSheet: false,
minHeight: 30,
maxHeight: 170,
panel: Container(
// color: Color(0xFF009BD4),
// child: Column(
// children: <Widget>[
// Container(
// width: MediaQuery.of(context).size.width,
// height: 30,
// child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
// ),
// Container(
// height: 140,
// child: SingleChildScrollView(
// child: Column(
// children: <Widget>[
// Container(
// padding: EdgeInsets.only(
// bottom: 20
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: <Widget>[
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// ],
// ),
// ),
// Container(
// padding: EdgeInsets.only(
// bottom: 20
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: <Widget>[
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// Container(
// color: Colors.white,
// width: 50,
// height: 50,
// ),
// ],
// ),
// ),
// ],
// )
// ),
// ),
// ],
// )
),
// collapsed: Container(
// color: Color(0xFF009BD4),
// child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
// ),
body: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFFFFAD8),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Kalan Bakiye", style: TextStyle(
fontFamily: "Verdana",
fontSize: 14,
color: Color(0xFF12C8F5)
),),
],
),
Text("1668,89 ₺", style: TextStyle(
fontFamily: "Verdana",
fontSize: 20,
color: Color(0xFF12C8F5)
),),
],
),
Icon(Icons.account_balance_wallet, color: Color(0xFF12C8F5),)
],
),
),
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFFFFAD8),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Yıllık Toplam", style: TextStyle(
fontFamily: "Verdana",
fontSize: 16,
color: Color(0xFF0E1D3A)
),),
Text("Teminat Bedeli", style: TextStyle(
fontFamily: "Verdana",
fontSize: 14,
color: Color(0xFF0E1D3A)
),),
],
),
Text("1000000,00 ₺", style: TextStyle(
fontFamily: "Verdana",
fontSize: 16,
color: Color(0xFF0E1D3A)
),),
],
),
Icon(Icons.queue, color: Color(0xFF0E1D3A),)
],
),
),
],
),
SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFFFFAD8),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Kayıtlı", style: TextStyle(
fontFamily: "Verdana",
fontSize: 14,
color: Color(0xFF0E1D3A)
),),
Text("İş Ortağı Sayısı", style: TextStyle(
fontFamily: "Verdana",
fontSize: 14,
color: Color(0xFF0E1D3A)
),),
],
),
Text("22,170", style: TextStyle(
fontFamily: "Verdana",
fontSize: 20,
color: Color(0xFF0E1D3A)
),),
],
),
Icon(Icons.people, color: Color(0xFF0E1D3A),)
],
),
),
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFFFFAD8),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Kayıtlı Araç", style: TextStyle(
fontFamily: "Verdana",
fontSize: 16,
color: Color(0xFF12C8F5)
),),
Text("Sayısı", style: TextStyle(
fontFamily: "Verdana",
fontSize: 16,
color: Color(0xFF12C8F5)
),),
],
),
Text("156,685", style: TextStyle(
fontFamily: "Verdana",
fontSize: 20,
color: Color(0xFF12C8F5)
),),
],
),
Icon(Icons.local_shipping, color: Color(0xFF12C8F5),)
],
),
),
],
),
// Pasta diliminin gösterildiği kısım...
// Container(
// width: 550,
// height: 450,
// padding: EdgeInsets.only(top: 50),
// child: pieChart(),
// ),
//Toplam beyan adedinin gösterildiği kısım...
// Container(
// child: Text(
// 'Toplam Beyan Sayısı: 350',
// style: TextStyle(
// fontFamily: "Verdana",
// fontSize: 20,
// color: Color(0xFF0B1C3A)
// ),
// ),
// )
],
)
),
bottomNavigationBar: BottomBarWidget()
)
);
}
// Current State of InnerDrawerState
final GlobalKey<InnerDrawerState> _innerDrawerKey = GlobalKey<InnerDrawerState>();
void _toggle()
{
_innerDrawerKey.currentState.toggle(
// direction is optional
// if not set, the last direction will be used
//InnerDrawerDirection.start OR InnerDrawerDirection.end
direction: InnerDrawerDirection.start
);
}
void _logout()async{
if(_isLoading) return;
_isLoading = true;
SharedPreferencesUtils.getInstance().then((pref)async{
bool result = await pref.logoout();
_isLoading = false;
if(result)
Navigator.push(context, MaterialPageRoute(builder: (context)=>LoginScreen()));
});
}
}
class Declerations{
String name;
int value;
Color colorValue;
Declerations(this.name, this.value, this.colorValue);
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/registrationPage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tobbund/controller/localAuth.dart';
import 'package:tobbund/screens/login.dart';
import 'package:tobbund/screens/sidebarItemScreens/administrativeFunctionsScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/accountScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/registrationProcedures.dart';
import 'package:tobbund/screens/sidebarItemScreens/helpSupportScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/regulationScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/reportScreen.dart';
import 'package:tobbund/screens/sidebarItemScreens/settingScreen.dart';
import 'package:tobbund/screens/sidebar.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';
import 'dart:io' show Platform;
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
bool _isLoading = false;
@override
Widget build(BuildContext context)
{
return InnerDrawer(
key: _innerDrawerKey,
onTapClose: true, // default false
swipe: true, // default true
colorTransition: Colors.white, // default Color.black54
// DEPRECATED: use offset
leftOffset: 0.6, // Will be removed in 0.6.0 version
rightOffset: 0.6,// Will be removed in 0.6.0 version
//When setting the vertical offset, be sure to use only top or bottom
offset: IDOffset.only(
left: 0.5,
top: 0,
bottom: 0
),
proportionalChildArea : true, // default true
leftAnimationType: InnerDrawerAnimation.static, // default static
rightAnimationType: InnerDrawerAnimation.quadratic,
backgroundColor: Color(0xFF405161), // default Theme.of(context).backgroundColor
// //when a pointer that is in contact with the screen and moves to the right or left
// onDragUpdate: (double val, InnerDrawerDirection direction) {
//
// },
// innerDrawerCallback: (a) => print(a), // return true (open) or false (close)
leftChild: SideBarWidget(
callback: (val){
_toggle();
switch(val){
case "administrativeFunctions":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => AdministrativeFunctionsScreen()));
break;
case "account":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => AccountScreen()));
break;
case "registrationProcedures":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => RegistrationProcedures()));
break;
case "regulation":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => RegulationScreen()));
break;
case "helpandsupport":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => HelpSupportScreen()));
break;
case "reports":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ReportScreen()));
break;
case "settings":
Navigator.of(context).push(MaterialPageRoute(builder: (context) => SettingScreen()));
break;
default:
_logout();
}
},
),
scaffold: Scaffold(
backgroundColor: Colors.grey[100],
appBar: PreferredSize(child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 50, left: 20, bottom: 10
),
child: InkWell(
onTap: (){
_toggle();
},
child: Icon(Icons.menu, color: Color(0xffFFCC1A), size: 35,),
),
),
Container(
padding: EdgeInsets.only(
top: 50, right: 20, bottom: 10
),
child: Image.asset("assets/images/logo.png",),
),
],
), preferredSize: Size.fromHeight(80)),
body: SlidingUpPanel(
renderPanelSheet: false,
minHeight: 30,
maxHeight: 170,
panel: Container(
color: Color(0xFF405161),
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 30,
child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
),
Container(
height: 140,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(
bottom: 20
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
],
),
),
Container(
padding: EdgeInsets.only(
bottom: 20
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
Container(
color: Colors.grey,
width: 50,
height: 50,
),
],
),
),
],
)
),
),
],
)
),
collapsed: Container(
color: Color(0xFF405161),
child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
),
body: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFFFF0C3),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Explicit", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xffED9B21)
),),
Text("Declarations", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xffED9B21)
),),
],
),
Text("1,668", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xffED9B21)
),),
],
),
Icon(Icons.library_books, color: Color(0xffED9B21),)
],
),
),
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFA0C9F2),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Active", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
Text("Declarations", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Text("7,685", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Icon(Icons.event_note, color: Color(0xff0B62B7),)
],
),
),
],
),
SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFA0C9F2),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Registered", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
Text("Business", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
Text("Partners", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Text("22,170", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Icon(Icons.event_note, color: Color(0xff0B62B7),)
],
),
),
Container(
width: MediaQuery.of(context).size.width/2-20,
height: (MediaQuery.of(context).size.width/2-20) * 0.6,
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Color(0xFFA0C9F2),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Registered", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
Text("Vehicles", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Text("156,685", style: TextStyle(
fontFamily: "Helvetica",
fontSize: 16,
color: Color(0xff0B62B7)
),),
],
),
Icon(Icons.event_note, color: Color(0xff0B62B7),)
],
),
),
],
),
],
)
),
bottomNavigationBar: Platform.isIOS?
Container(
height: 100,
padding: EdgeInsets.only(top: 10),
color: Color(0xFF0B52A2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
InkWell(
onTap: (){
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/registration.png",fit: BoxFit.contain, color: Colors.white,),
),
SizedBox(height: 5,),
Text("Registration List", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
///////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
width: 40,
child: Image.asset("assets/images/decleration.png",fit: BoxFit.contain, color: Colors.white,),
),
SizedBox(height: 5,),
Text("New Decleration", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
//////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/client.png",fit: BoxFit.contain, color: Colors.white,),
),
SizedBox(height: 5,),
Text("Client Data", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
//////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/invoice.png",fit: BoxFit.contain, color: Colors.white,),
),
SizedBox(height: 5,),
Text("Invoice Report", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
)
],
),
):
Container(
height: 80,
padding: EdgeInsets.only(top: 10),
color: Color(0xFF0B52A2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
InkWell(
onTap: (){
},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/registration.png",fit: BoxFit.contain,),
),
SizedBox(height: 5,),
Text("Registration List", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
///////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
width: 40,
child: Image.asset("assets/images/decleration.png",fit: BoxFit.contain,),
),
SizedBox(height: 5,),
Text("New Decleration", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
//////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/client.png",fit: BoxFit.contain,),
),
SizedBox(height: 5,),
Text("Client Data", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
),
//////////
InkWell(
onTap: (){},
child: Container(
child: Column(
children: <Widget>[
Container(
height: 50,
child: Image.asset("assets/images/invoice.png",fit: BoxFit.contain,),
),
SizedBox(height: 5,),
Text("Invoice Report", style: TextStyle(color: Colors.white, fontFamily: "Helvetica", fontSize: 12),)
],
)
),
)
],
),
),
)
);
}
// Current State of InnerDrawerState
final GlobalKey<InnerDrawerState> _innerDrawerKey = GlobalKey<InnerDrawerState>();
void _toggle()
{
_innerDrawerKey.currentState.toggle(
// direction is optional
// if not set, the last direction will be used
//InnerDrawerDirection.start OR InnerDrawerDirection.end
direction: InnerDrawerDirection.start
);
}
void _logout()async{
if(_isLoading) return;
_isLoading = true;
SharedPreferencesUtils.getInstance().then((pref)async{
bool result = await pref.logoout();
_isLoading = false;
if(result)
Navigator.push(context, MaterialPageRoute(builder: (context)=>LoginScreen()));
});
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDeclerationPage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/controller/new_declerations_provider.dart';
import 'package:tobbund/model/TRNItem.dart';
import 'package:tobbund/model/voyages.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home/declerations/declerationPreviousDetailsPage.dart';
import 'package:tobbund/screens/home/newDecleration/searchDialogForCompany.dart';
import 'package:tobbund/screens/home/newDecleration/searchDialogForCarrier.dart';
import 'package:tobbund/screens/home/newDecleration/dropdownDialogForRejim.dart';
import 'package:tobbund/screens/home/newDecleration/dropdownDialogForTransmod.dart';
import 'package:tobbund/screens/home/newDecleration/dropdownDialogForCekici.dart';
import 'package:tobbund/screens/home/newDecleration/dropdownDialogForTreyler.dart';
import 'package:tobbund/screens/home/newDecleration/voyagesDialog.dart';
import 'package:tobbund/screens/home.dart';
import 'package:toast/toast.dart';
import 'package:tobbund/widgets/dialog.dart';
class NewDeclerationPage extends StatefulWidget {
final Declaration declaration;
NewDeclerationPage({this.declaration});
@override
_NewDeclerationPageState createState() => _NewDeclerationPageState();
}
class _NewDeclerationPageState extends State<NewDeclerationPage> {
bool _isLoading = false;
bool _companyChange;
Map<String, dynamic> _companyName = {};
int _companyId = UserRepository().user.sirketId;
Map<String, dynamic> _carrier;
String _truckCode;
String _trailerCode;
//String _selectedRegimeCode;
String _selectedRegimeCode = 'ENS';
String _selectedTransMode;
final _konteynerController = new TextEditingController();
bool _isValid = false;
Voyages _voyages;
final GlobalKey<State> _keyLoader = new GlobalKey<State>();
final Map<String, String> _tasimaModuMap = {
"UND": "UN RoRo",
"ULU": "Ulusoy",
"SLS":"Sea Lines"
};
@override
void initState() {
// TODO: implement initState
super.initState();
if (widget.declaration != null) {
print(widget.declaration.toJson());
_companyName['name'] = widget.declaration.firmaAd;
_companyName['id'] = widget.declaration.firmaId;
_companyName['firmaId'] = UserRepository().user.sirketId;
_carrier = {
"id": widget.declaration.tasiyiciId,
"name": widget.declaration.tasiyici
};
_truckCode = widget.declaration.plaka;
_selectedRegimeCode = widget.declaration.rejimKodu;
_selectedTransMode = widget.declaration.tasimaModu;
} else {
_companyName['name'] = UserRepository().user.ticaretUnvani ?? "";
_companyName['id'] = UserRepository().user.firmaId;
_companyName['firmaId'] = UserRepository().user.sirketId;
if (_companyId != 1000) {
_companyName["name"] = UserRepository().user.ticaretUnvani;
_companyChange = false;
setState(() {});
}else{
_companyName["name"] == "";
_companyChange = true;
setState(() {});
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[100],
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Yeni ENS Beyanı"),
// Eray - Start //
leading: GestureDetector(
onTap: () {
if (widget.declaration != null) {
Navigator.pop(context);
} else {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => HomeScreen()));
}
},
child: Icon(
Icons.arrow_back_ios,
),
),
),
body: ListView(
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon1-company.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: !UserRepository().user.superUser?
ListTile(
title: Text(
"Firma",
style:
TextStyle(color: Colors.grey[400], fontSize: 15),
),
subtitle: Text(
_companyName['name'],
style:
TextStyle(color: Colors.grey[400], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down, color: Colors.grey[300],),
):
ListTile(
enabled: _companyChange,
onTap: () async {
Map<String, dynamic> result = await showDialog<Map<String, dynamic>>(
context: context,
builder: (context) {
return SearchDialogForCompany();
});
if (result == null) return;
_carrier = null;
_truckCode = null;
_trailerCode = null;
_companyName = result;
setState(() {});
},
title: Text("Firma", style: TextStyle(color: Colors.grey, fontSize: 15),),
subtitle: Text(_companyName['name'] ?? "Seçiniz...", style: TextStyle(color: Colors.black, fontSize: 17),),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon2-carrier.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
Map<String, dynamic> result =
await showDialog<Map<String, dynamic>>(
context: context,
builder: (context) {
return SearchDialogForCarrier(company: _companyName,);
});
if (result != null) {
if(result != _carrier){
_truckCode = null;
_trailerCode = null;
}
_carrier = result;
setState(() {});
}
},
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Taşıyıcı",
style: TextStyle(
color: Colors.grey[800], fontSize: 15),
),
Text(
" *",
style: TextStyle(
color: Colors.red[800], fontSize: 15),
),
],),
subtitle: Text(
_carrier == null
? "Seçiniz"
: _carrier['name'],
style: TextStyle(
color: Colors.grey[800], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
_isValid && _carrier == null
? Container(
padding: EdgeInsets.all(10),
child: Text(
"Zorunlu alan",
style: TextStyle(color: Colors.red[300]),
),
)
: Container()
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon3-rcode.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
String result = await showDialog(
context: context,
builder: (context) {
return DropdownDialogForRejim();
});
if (result == null) return;
_selectedRegimeCode = result;
setState(() {});
},
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Rejim",
style: TextStyle(
color: Colors.grey[800], fontSize: 15),
),
Text(
" *",
style: TextStyle(
color: Colors.red[800], fontSize: 15),
),
],),
subtitle: Text(
_selectedRegimeCode ?? "Seçiniz",
style: TextStyle(
color: Colors.grey[800], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
_isValid && _selectedRegimeCode == null
? Container(
padding: EdgeInsets.all(10),
child: Text(
"Zorunlu Alan",
style: TextStyle(color: Colors.red[300]),
),
)
: Container()
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon4-tmode.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
String result = await showDialog(
context: context,
builder: (context) {
return DropdownDialogForTransmod();
});
if (result == null) return;
_selectedTransMode = result;
setState(() {});
},
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Taşıma Modu",
style: TextStyle(
color: Colors.grey[800], fontSize: 15),
),
Text(
" *",
style: TextStyle(
color: Colors.red[800], fontSize: 15),
),
],),
subtitle: Text(
_tasimaModuMap[_selectedTransMode] ?? "Seçiniz",
style: TextStyle(
color: Colors.grey[800], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
_isValid && _selectedTransMode == null
? Container(
padding: EdgeInsets.all(10),
child: Text(
"Zorunlu Alan",
style: TextStyle(color: Colors.red[300]),
),
)
: Container()
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon5-expedition.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
String endpoint;
if(_selectedTransMode == "UND"){
endpoint = "GetVoyagesUnRoro";
}
if(_selectedTransMode == "ULU"){
endpoint = "GetVoyagesUlusoy";
}
if(endpoint==null)return;
var result = await showDialog(context: context, builder: (context){
return VoyagesDialog(endpoint: endpoint,);
});
if(result!=null){
_voyages = Voyages.fromJson(result);
setState(() {
});
}
},
title: Text(
"Sefer",
style: TextStyle(
color: Colors.grey, fontSize: 15),
),
subtitle: Text(
_voyages==null?"Seçiniz":"${_voyages.vesselName} / ${_voyages.departureDate} \n/ ${_voyages.departurePort} - ${_voyages.arrivalPort}",
style: TextStyle(
color: Colors.grey[800], fontSize: 15),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon6-wrecker.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
if(_carrier == null) return;
String result = await showDialog(
context: context,
builder: (context) {
return DropdownDialogForCekici(company: _companyName);
});
if (result == null) return;
_truckCode = result;
setState(() {});
},
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
"Çekici",
style: TextStyle(
color: Colors.grey[800], fontSize: 15),
),
Text(
" *",
style: TextStyle(
color: Colors.red[800], fontSize: 15),
),
],),
subtitle: Text(
_truckCode ?? "Seçiniz",
style: TextStyle(
color: Colors.grey[800], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
_isValid && _truckCode == null
? Container(
padding: EdgeInsets.all(10),
child: Text(
"Zorunlu Alan",
style: TextStyle(color: Colors.red[300]),
),
)
: Container()
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon7-trailer.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: ListTile(
onTap: () async {
if(_carrier == null) return;
String result = await showDialog(
context: context,
builder: (context) {
return DropdownDialogForTreyler(company: _companyName,);
});
if (result == null) return;
_trailerCode = result;
setState(() {});
},
title: Text(
"Treyler",
style: TextStyle(
color: Colors.grey, fontSize: 15),
),
subtitle: Text(
_trailerCode ?? "Seçiniz",
style: TextStyle(
color: Colors.grey[800], fontSize: 17),
),
trailing: Icon(Icons.arrow_drop_down),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
],
),
Stack(
alignment: Alignment(1, -1),
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 60,
alignment: Alignment.centerRight,
child: Image.asset(
"assets/images/icon8-container.png",
width: 50,
),
),
Container(
width: MediaQuery.of(context).size.width - 60,
child: TextField(
controller: _konteynerController,
maxLength: 11,
keyboardType: TextInputType.text,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: UnderlineInputBorder(
borderSide: BorderSide.none),
hintText: "Varsa konteyner numarası giriniz.",
hintStyle: TextStyle(
color: Colors.black87,
fontSize: 16,
fontWeight: FontWeight.w500),
labelText: "Konteyner",
),
),
),
],
),
Container(
color: Colors.grey[200],
height: 1,
),
],
),
],
),
SizedBox(
height: 5,
),
],
),
floatingActionButton: FloatingActionButton(
backgroundColor: Color(0xFF007DB9),
onPressed: ()async{
if (_carrier == null ||
_selectedRegimeCode == null ||
_selectedTransMode == null ||
_truckCode == null ||
(_konteynerController.text.length < 11 &&
_konteynerController.text.length > 0)) {
print(_konteynerController.text.length);
Toast.show("Lütfen zorunlu alanları doldurun.", context,
duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
setState(() {
_isValid = true;
});
return;
}
//if(!await Dialogs.confirmDialog(context, "Are you sure?")) return;
if(_isLoading)return;
_isLoading = true;
Map _param;
String _url;
if (widget.declaration == null) {
_param = {
"sirket_Id": _companyId,
"firma": "${_companyName['id']}",
"kFirma": "${_carrier['id']}",
"rejimKodu": _selectedRegimeCode,
"giris": UserRepository().user.id,
"gumruk": "TR999999",
"tasima_Mod": "${_selectedTransMode}",
"plaka": _truckCode,
"plaka2": _trailerCode,
"container": _konteynerController.text,
};
_url = "AddPosition";
} else {
print(widget.declaration.otoId);
_param = {
"oto_Id": widget.declaration.otoId,
"sirket_Id": _companyId,
"firma": "${_companyName['id']}",
"kFirma": "${_carrier['id']}",
"rejimKodu": _selectedRegimeCode,
"giris": UserRepository().user.id,
"gumruk": "TR999999",
"plaka": _truckCode,
"plaka2": _trailerCode,
"container": _konteynerController.text
};
_url = "UpdatePosition";
}
var result =
await ApiHelper().doListPostRequest(_url, _param);
_isLoading = false;
print(result);
if(result.isNotEmpty){
Provider.of<NewDeclarationProvider>(context, listen: false).sekirtId = _companyName['firmaId'];
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: false,
title: "Başarılı!",
description: "Pozisyon oluşturuldu.",
icon: "success",
);
await Future.delayed(Duration(seconds: 2));
Map<String, dynamic> _param = {
"authorityLevel": UserRepository().user.yetkiDuzeyi,
"firmId": UserRepository().user.sirketId,
"userId": UserRepository().user.id,
"search": result[0]['reF_POS'],
"lastId": "0"
};
String _endpoint = "GetPositions";
var declaration;
List<TRNItem> _trns = [];
try {
var responseForDeclaration = await ApiHelper().doListPostRequest(_endpoint, _param);
declaration = new Declaration.fromJson(responseForDeclaration[0]);
const String endpoint = "GetTRNs";
var params = {
"refNumber": declaration.ref,
"firmId": declaration.sirketId,
};
var response = await ApiHelper().doListPostRequest(endpoint, params);
for (var item in response) {
_trns.add(TRNItem.fromJson(item));
}}
catch(e){
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: true,
title: "Hata!",
description: "Pozisyon oluşturulamadı!",
icon: "failed",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
return;
}
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => DeclerationPreviousDetailsPage(trns: _trns, declaration: declaration,)));
}else{
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: true,
title: "Hata!",
description: "Pozisyon oluşturulamadı!",
icon: "failed",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
}
},
child: Icon(Icons.check),
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 1,
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerationsPage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/TRNItem.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home.dart';
import 'package:tobbund/screens/home/newDeclerationPage.dart';
import 'package:tobbund/screens/home/declerations/declerationPreviousDetailsPage.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'declerations/declerationDetailsPage.dart';
import 'package:toast/toast.dart';
class DeclerationsPage extends StatefulWidget {
@override
_DeclerationsPageState createState() => _DeclerationsPageState();
}
class _DeclerationsPageState extends State<DeclerationsPage> {
final _searchController = new TextEditingController();
bool _isSearching = true;
bool _isLoading = false;
List<Declaration> _declarationList = [];
RefreshController _refreshController =
RefreshController(initialRefresh: false);
String _lastItemId;
String _searchText = ""; // "kar"
int lastDeclarationCount = 10;
Widget DeclerationItemWidget(Declaration _declaration, BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 10, right: 10, left: 10),
child: InkWell(
onTap: () {
_getTRNsAndGo(_declaration);
},
child: Stack(
children: <Widget>[
Card(
elevation: 5,
color: Colors.grey[100],
child: Padding(
padding: EdgeInsets.all(7),
child: Column(
children: <Widget>[
_detailsItemWidget(context, name: "Kayıt Numarası", value: "${_declaration.id}", image: "assets/images/1.PNG"),
_detailsItemWidget(context, name: "Firma", value: "${_declaration.firmaAd}", image: "assets/images/2.PNG"),
_detailsItemWidget(context, name: "Taşıyıcı", value: "${_declaration.tasiyici}", image: "assets/images/3.PNG"),
_detailsItemWidget(context, name: "Plaka", value: "${_declaration.plaka}", image: "assets/images/4.PNG"),
_detailsItemWidget(context, name: "LRN / MRN", value: "${_declaration.mrn??""}", image: "assets/images/5.PNG"),
_detailsItemWidget(context, name: "Tarih", value: "${_declaration.duzenliTarih}", image: "assets/images/6.PNG"),
_detailsItemWidget(context, name: "Rota", value: "${_declaration.rotaBilgi}", image: "assets/images/8.PNG"),
_detailsItemWidget(context, name: "Rejim", value: "${_declaration.rejimKodu}", image: "assets/images/9.PNG"),
_detailsItemWidget(context, name: "Statü", value: "${_declaration.ensStatu ?? ""}", image: "assets/images/7.PNG"),
],
)
),
),
Positioned(
top: 20,
right: 20,
child: Container(
height: 30,
margin: EdgeInsets.only(bottom: 10
),
child: RaisedButton(
padding: EdgeInsets.all(0),
color: Color(0xFF007DB9),
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NewDeclerationPage(
declaration: _declaration,
)));
},
child: Row(
children: <Widget>[
Icon(Icons.edit, color: Colors.white, size: 18,),
Text("Güncelle", style: TextStyle(color: Colors.white, ),)
],
),
),
),
),
Positioned(
bottom: 20,
right: 20,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
//Text("", style: TextStyle(color: Colors.lightGreen, fontWeight: FontWeight.bold),),
//Icon(Icons.lens, color: Colors.lightGreen, size: 20,)
],
),
),
],
),
));
}
Widget _detailsItemWidget(BuildContext context, {@required String name, String value, String image}){
return Container(
margin: EdgeInsets.only(top: 7
, left: 10, right: 10),
padding: EdgeInsets.only(bottom: 5),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 0.7
)
)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(image, width: 30,),
SizedBox(width: 10,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(name, style: TextStyle(
fontSize: 12,
color: Colors.grey[700]
),),
SizedBox(height: 5,),
Container(
width: MediaQuery.of(context).size.width-108,
child: Text(value, style: TextStyle(
fontSize: 14
),),
),
],
)
],
),
);
}
@override
void initState() {
// TODO: implement initState
super.initState();
_search("", "0"); // "kar"
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
leading: IconButton(
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => HomeScreen()),
ModalRoute.withName('/'),
);
},
icon: Icon(Icons.arrow_back_ios),
),
backgroundColor: Color(0xFF187EA0),
title: Text("Tescil Listesi"),
),
// body: SlidingUpPanel(
// renderPanelSheet: false,
// minHeight: 30,
// maxHeight: 170,
// panel: Container(
// color: Color(0xFFFFAB00),
// child: Column(
// children: <Widget>[
// // Container(
// // width: MediaQuery.of(context).size.width,
// // height: 30,
// // child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
// // ),
// // Container(
// // height: 140,
// // child: SingleChildScrollView(
// // child: Column(
// // children: <Widget>[
// // Container(
// // padding: EdgeInsets.only(
// // bottom: 20
// // ),
// // child: Row(
// // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// // children: <Widget>[
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // ],
// // ),
// // ),
// // Container(
// // padding: EdgeInsets.only(
// // bottom: 20
// // ),
// // child: Row(
// // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// // children: <Widget>[
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // Container(
// // color: Colors.white,
// // width: 40,
// // height: 50,
// // ),
// // ],
// // ),
// // ),
// // ],
// // )
// // ),
// // ),
// ],
// )
// ),
// collapsed: Container(
// color: Color(0xFFFFAB00),
// child: Icon(Icons.drag_handle, color: Colors.white, size: 30,),
// ),
body: SingleChildScrollView(
child: Container(
child: Column(
children: <Widget>[
TextField(
controller: _searchController,
onChanged: (val) async {
_searchText = val;
if (val.length == 0) {
_isSearching = true;
setState(() {});
_search("", "0");
}
if (val.length < 3) return;
_declarationList = [];
_isSearching = true;
setState(() {});
await _search(val, '0');
},
decoration: InputDecoration(
prefixIcon: Icon(Icons.search),
contentPadding: EdgeInsets.only(top: 15, bottom: 15)),
),
Stack(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height - 180,
child: SmartRefresher(
enablePullDown: true,
enablePullUp: true,
header: WaterDropHeader(),
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
Widget body;
if (mode == LoadStatus.loading) {
body = CupertinoActivityIndicator();
} else {
body = Container();
}
return Container(
padding: EdgeInsets.all(20),
child: body,
);
},
),
controller: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView(
children: _declarationList.map((data) {
return DeclerationItemWidget(data, context);
}).toList(),
),
),
),
_isSearching
? Center(
child: Container(
padding: EdgeInsets.only(top: 50),
child: CircularProgressIndicator(
backgroundColor: Colors.white,
strokeWidth: 1.5,
),
))
: Container(),
_isLoading
? Container(
color: Colors.grey.withOpacity(0.4),
height: MediaQuery.of(context).size.height - 220,
child: Center(
child: Container(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
strokeWidth: 1.5,
),
)),
)
: Container(),
],
)
],
),
// ),
),
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 0,
));
}
Future _search(String _txt, String ref) async {
if (ref == "0") {
_declarationList = [];
lastDeclarationCount = 10;
}
if(lastDeclarationCount < 10)return;
Map<String, dynamic> _param = {
"authorityLevel": UserRepository().user.yetkiDuzeyi,
"firmId": UserRepository().user.sirketId,
"userId": UserRepository().user.id,
"basTarih": null,
"bitisTarih": null,
"search": _txt,
"lastId": ref
};
String _endpoint = "GetPositions";
var response = await ApiHelper().doListPostRequest(_endpoint, _param);
print(response);
for (var item in response) {
Declaration _decleration = new Declaration.fromJson(item);
_declarationList.add(_decleration);
}
if(_declarationList.isNotEmpty) {
_lastItemId = _declarationList.last.ref;
lastDeclarationCount = response.length;
}
_isSearching = false;
setState(() {});
}
void _onRefresh() async {
// monitor network fetch
// if failed,use refreshFailed()
_lastItemId = "0";
await _search(_searchText, "0");
_refreshController.refreshCompleted();
}
void _onLoading() async {
// monitor network fetch
// if failed,use loadFailed(),if no data return,use LoadNodata()
await _search(_searchText, _lastItemId);
_refreshController.loadComplete();
}
void _getTRNsAndGo(Declaration declaration) async {
setState(() {
_isLoading = true;
});
List<TRNItem> _trns = [];
const String endpoint = "GetTRNs";
var params = {
"refNumber": declaration.ref,
"firmId": declaration.sirketId,
};
try {
var response = await ApiHelper().doListPostRequest(endpoint, params);
for (var item in response) {
_trns.add(TRNItem.fromJson(item));
}
// if (_trns.isEmpty) {
// setState(() {
// _isLoading = false;
// });
// Toast.show("Bu pozisyon içerisinde beyan yoktur.", context,
// duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
// return;
// }
//
// if (_trns.length == 1) {
// await Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => DeclerationDetailsPage(
// trnNumber: _trns[0].ref,
// lrn_mrn: _trns[0].lrn,
// declaration: declaration,
// )));
// }
// if (_trns.length > 1) {
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DeclerationPreviousDetailsPage(
trns: _trns,
declaration: declaration,
)));
// }
} catch (e) {
print("error: ${e.toString()}");
}
setState(() {
_isLoading = false;
});
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/customerInformation.dart | import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home.dart';
import 'package:tobbund/controller/apiHelper.dart';
class CustomerInformation extends StatefulWidget {
@override
_CustomerInformationState createState() => _CustomerInformationState();
}
class _CustomerInformationState extends State<CustomerInformation> {
final _companyNameController = new TextEditingController();
final _taxNumberController = new TextEditingController();
final _eoriNumberController = new TextEditingController();
final _addressController = new TextEditingController();
final _postCodeController = new TextEditingController();
@override
void initState() {
_search(UserRepository().user.ticaretUnvani);
super.initState();
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Müşteri Bilgileri", style: TextStyle(fontFamily: "Verdana"),),
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Icon(
Icons.arrow_back_ios,
),
),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: ListView(
physics: NeverScrollableScrollPhysics(),
children: [
TextField(
controller: _companyNameController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(
Icons.business,
color: Colors.grey[700],
),
labelText: "Ünvan",
),
),
TextField(
controller: _taxNumberController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(
Icons.work,
color: Colors.grey[700],
),
labelText: 'Vergi Numarası',
),
),
TextField(
controller: _eoriNumberController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(
Icons.business_center,
color: Colors.grey[700],
),
labelText: 'Eori Numarası',
),
),
TextField(
controller: _addressController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(
Icons.location_on,
color: Colors.grey[700],
),
labelText: 'Adres',
),
maxLines: 2,
),
TextField(
controller: _postCodeController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(
Icons.pin_drop,
color: Colors.grey[700],
),
labelText: 'Posta Kodu',
),
),
],
)),
bottomNavigationBar: BottomBarWidget(
pageIndex: 2,
),
);
}
_search(String _txt) async {
Map<String, dynamic> _param = {"companyName": _txt};
String _endpoint = "GetCompanies";
var response = await ApiHelper().doListPostRequest(_endpoint, _param);
for (var item in response) {
setState(() {
_companyNameController.text = item['unvan'];
_taxNumberController.text = item['vergiNo'];
_eoriNumberController.text = item['eoriNo'];
_addressController.text = item['adres'];
_postCodeController.text = item['postaKodu'];
});
}
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/dropdownDialogForRejim.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:flutter/cupertino.dart';
class DropdownDialogForRejim extends StatefulWidget {
@override
_DropdownDialogForRejimState createState() => _DropdownDialogForRejimState();
}
class _DropdownDialogForRejimState extends State<DropdownDialogForRejim> {
List<String> _regimeCodes = [];
@override
void initState() {
// TODO: implement initState
super.initState();
_init();
}
void _init()async{
var response = await ApiHelper().doBodyPostRequest('GetRegimeCodes', null);
if(response['name'] == null){
return;
}
for(var item in response['name']){
if(item == "ENS")
_regimeCodes.add(item);
}
setState(() {
});
}
@override
Widget build(BuildContext context) {
return Dialog(
child: SingleChildScrollView(
child: _regimeCodes.isEmpty?
Container(
height: 100,
child: Center(
child: CupertinoActivityIndicator(),
),
):
Column(
mainAxisSize: MainAxisSize.min,
children: _regimeCodes.map((val){
return ListTile(
onTap: (){
if(val != "ENS") return;
Navigator.pop(context, val);
},
title: Text(val),
);
}).toList(),
),
)
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/searchDropdownDialog.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
class SearchDropdownDialog extends StatefulWidget {
final String endpoint;
final String target;
final Map<String, dynamic> params;
final String searchTarget;
final bool nonSearchable;
SearchDropdownDialog({this.endpoint, this.target, this.params, this.searchTarget, this.nonSearchable=false});
@override
_SearchDropdownDialogState createState() => _SearchDropdownDialogState();
}
class _SearchDropdownDialogState extends State<SearchDropdownDialog> {
final _searchController = new TextEditingController();
List<Map<String, dynamic>> _resuls = [];
bool _isSearching = false;
@override
void initState() {
// TODO: implement initState
super.initState();
if(widget.params != null){
String _searchText = "";
_searchText = widget.params[widget.searchTarget]??"";
_search(widget.params[widget.searchTarget]);
}
else
_search("");
}
Widget _searchWidget(){
return TextField(
style: TextStyle(
color: Colors.black
),
autofocus: true,
controller: _searchController,
onChanged: (val){
if(val.length == 1){
_resuls = [];
setState(() {
});
return;
}
if(val.length < 2)return;
_search(val);
},
decoration: InputDecoration(
hintText: "Ara",
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
),
);
}
Widget _searchResultWidget(){
return Container(
child: _isSearching?
Container(
padding: EdgeInsets.all(30),
child: Text("Aranıyor...", style: TextStyle(
color: Colors.grey
),),
):Column(
children: _resuls.map((data){
return
Container(
child: Column(
children: <Widget>[
ListTile(
onTap: (){
Navigator.pop(context, data);
},
title: Text(data[widget.target]??""),
),
Container(
color: Colors.grey[300],
height: 1,
),
],
),
);
}).toList(),
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
children: <Widget>[
ListView(
children: <Widget>[
widget.nonSearchable?Container():SizedBox(height: 50,),
_searchResultWidget(),
],
),
widget.nonSearchable?Container():_searchWidget(),
],
)
);
}
_search(String _txt)async{
if(widget.endpoint==null)return;
_isSearching = true;
setState(() {
});
Map<String, dynamic> _param = widget.params??{};
if(widget.searchTarget != null)
_param[widget.searchTarget] = _txt;
String _endpoint = widget.endpoint;
var response = await ApiHelper().doListPostRequest(_endpoint, _param);
_resuls = [];
for(var item in response){
_resuls.add(item);
}
_isSearching = false;
setState(() {
});
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/voyagesDialog.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/voyages.dart';
class VoyagesDialog extends StatefulWidget {
final String endpoint;
VoyagesDialog({this.endpoint});
@override
_VoyagesDialogState createState() => _VoyagesDialogState();
}
class _VoyagesDialogState extends State<VoyagesDialog> {
List<Voyages> _voyages = [];
bool _isLoading = true;
@override
void initState() {
// TODO: implement initState
super.initState();
_init();
}
@override
Widget build(BuildContext context) {
return Dialog(
child: SingleChildScrollView(
child: _isLoading
? Container(
height: 100,
child: Center(
child: CupertinoActivityIndicator(),
),
):
Column(
children: _voyages.map((data) {
return InkWell(
onTap: (){
Navigator.of(context).pop(data.toJson());
},
child: Container(
padding: EdgeInsets.all(2),
child: Card(
child: Container(
padding: EdgeInsets.all(5),
child: Column(
children: <Widget>[
Container(
width: double.infinity,
child: Row(
children: <Widget>[
Expanded(
flex:2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Gemi Adi", style: TextStyle(fontSize: 12, color: Colors.blue[900]),),
Text("${data.vesselName}"),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Kalkis Yeri", style: TextStyle(fontSize: 12, color: Colors.blue[900]),),
Text("${data.departurePort}"),
],
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Varis Yeri", style: TextStyle(fontSize: 12, color: Colors.blue[900]),),
Text("${data.arrivalPort}"),
],
),
),
],
),
),
Divider(),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text("Kalkis Tarihi: ", style: TextStyle(fontSize: 12, color: Colors.blue[900]),),
Text("${data.departureDate}"),
],
),
),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text("Varis Tarihi : ", style: TextStyle(fontSize: 12, color: Colors.blue[900]),),
Text("${data.arrivalDate}"),
],
),
),
],
),
),
),
),
);
}).toList(),
),
)
);
}
_init()async{
_isLoading = true;
setState(() {});
var response = await ApiHelper().doListPostRequest('${widget.endpoint}', {});
for (var item in response) {
_voyages.add(Voyages.fromJson(item));
}
if (mounted)
setState(() {
_isLoading = false;
});
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/addProductScreen.dart | import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toast/toast.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/controller/new_declerations_provider.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/newproduct/gtip_model.dart';
import 'package:tobbund/model/products.dart';
import 'package:tobbund/repository/UserRepository.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home/newDecleration/searchDropdownDialog.dart';
import 'package:tobbund/widgets/dialog.dart';
class AddProductScreen extends StatefulWidget {
String trnNumber;
Declaration declaration;
AddProductScreen({this.declaration, this.trnNumber});
@override
_AddProductScreenState createState() => _AddProductScreenState();
}
class _AddProductScreenState extends State<AddProductScreen> {
final GlobalKey<State> _keyLoader = GlobalKey<State>();
final _labelStyle = TextStyle(
color: Colors.grey,
fontSize: 12
);
final _labelMandatoryStyle = TextStyle(
color: Colors.red[800],
fontSize: 12
);
final _valueStyle = TextStyle(
color: Colors.grey[800],
fontSize: 14,
fontWeight: FontWeight.w600
);
bool _loading = false;
bool _active = false;
bool _parcali = true;
String _gtip;
String _vergiOrani;
final _tricariTanimController = TextEditingController();
String _kapTipi;
final _kapAdetController = TextEditingController();
final _brutKgController = TextEditingController();
final _netKgController = TextEditingController();
final _tutarController = TextEditingController();
String _doviz;
bool _checkActive(){
if(_gtip == null||
_tricariTanimController.text == null||
_kapAdetController.text == ""||
_brutKgController.text == ""||
_netKgController.text == ""||
_tutarController.text == ""||
_doviz == null
){
return false;
}
return true;
}
@override
void initState() {
// TODO: implement initState
super.initState();
_kapTipi = "BI - Kap";
}
@override
Widget build(BuildContext context) {
_active = _checkActive();
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("${widget.declaration.id} / ${widget.trnNumber} / Kalem", style: TextStyle(fontSize: 16),
),
),
body: _loading?
Container(
color: Colors.grey[200].withOpacity(0.5),
child: Center(
child: CupertinoActivityIndicator(),
),
):
Container(
padding: EdgeInsets.only(top: 10.0),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
color: Colors.grey[200],
height: 40,
margin: EdgeInsets.only(left: 10, right: 10),
child: Row(
children: <Widget>[
Expanded(child: Container(
alignment: Alignment.center,
child: Text("Beyan", style: TextStyle(color: Colors.grey[800]),),
)),
Expanded(child: Container(
color: Color(0xFF0B40A2),
alignment: Alignment.center,
child: Text("Kalem", style: TextStyle(color: Colors.white),),
)),
],
)),
Divider(
color: Colors.grey[700],
),
Container(
height: MediaQuery.of(context).size.height -
(Platform.isIOS ? 234 : 204),
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(10),
child: Material(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
elevation: 8,
child: Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20),
child: Column(
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("G.T.i.P *", style: _labelMandatoryStyle,),
Container(
child: Row(
children: <Widget>[
Text("Vergi Orani: "
"", style: _labelStyle,),
Text(_vergiOrani == null?"":"%${_vergiOrani}", style: _valueStyle,)
],
)
)
],
),
InkWell(
onTap: ()async{
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetGtipNo",
target: "fGtip",
searchTarget: "gtip",
params: {"gtip": "vv"},
));
if(result==null)return;
GtipNo _gtipNo = GtipNo.fromJson(result);
_gtip = _gtipNo.fGtip;
_vergiOrani = _gtipNo.vergiOrani.toString();
_tricariTanimController.text = _gtipNo.tanimTr;
TextField(keyboardType: TextInputType.number,);
setState(() {
});
},
child: Container(
margin: EdgeInsets.only(top: 5, bottom: 5, right: 5),
padding: EdgeInsets.all(3),
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: Row(
children: <Widget>[
Expanded(
child: Text(_gtip??"", style: _valueStyle,),
),
Icon(Icons.arrow_drop_down, color: Colors.grey[600],)
],
)
),
)
],
),
),
Expanded(
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('Kalem No: 1', style: _labelStyle,)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Switch(
value: _parcali,
onChanged: (val){
_parcali = val;
setState(() {
});
},
activeColor: Color(0xFF0B40A2),
),
SizedBox(width: 20,),
Text('Parcali: ${_parcali?"E":"H"}', style: _labelStyle,)
],
),
],
),
),
)
],
),
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Ticari Tanim *", style: _labelMandatoryStyle,),
SizedBox(height: 5,),
TextField(
controller: _tricariTanimController,
maxLines: 4,
minLines: 4,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: OutlineInputBorder(),
),
),
],
),
),
Container(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text("Kap Tipi *", style: _labelMandatoryStyle,),
],
),
InkWell(
onTap: ()async{
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetCaseTypes",
target: "kod",
nonSearchable: true,
));
if(result==null)return;
_kapTipi = result['kod'];
setState(() {
});
},
child: Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 5, right: 10),
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: Row(
children: <Widget>[
Expanded(
child: Text(_kapTipi??"", style: _valueStyle,),
),
Icon(Icons.arrow_drop_down, color: Colors.grey[600],)
],
)
)
)
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: 10,),
Text("Kap Adet *", style: _labelMandatoryStyle,),
],
),
Container(
height: 32,
margin: EdgeInsets.only(top: 5, left: 10),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: TextField(
controller: _kapAdetController,
keyboardType: TextInputType.number,
onEditingComplete: (){
setState(() {
});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: OutlineInputBorder(borderSide: BorderSide.none)
),
),
)
],
),
),
],
),
),
Container(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text("Brut Kg *", style: _labelMandatoryStyle,),
],
),
Container(
height: 32,
margin: EdgeInsets.only(top: 5, right: 10),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: TextField(
controller: _brutKgController,
keyboardType: TextInputType.number,
onEditingComplete: (){
setState(() {
});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: OutlineInputBorder(borderSide: BorderSide.none)
),
),
)
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: 10,),
Text("Net Kg *", style: _labelMandatoryStyle,),
],
),
Container(
height: 32,
margin: EdgeInsets.only(top: 5, left: 10),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: TextField(
controller: _netKgController,
keyboardType: TextInputType.number,
onEditingComplete: (){
setState(() {
});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: OutlineInputBorder(borderSide: BorderSide.none)
),
),
)
],
),
),
],
),
),
Container(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text("Tutar *", style: _labelMandatoryStyle,),
],
),
Container(
height: 32,
margin: EdgeInsets.only(top: 5, right: 10),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: TextField(
controller: _tutarController,
keyboardType: TextInputType.number,
onEditingComplete: (){
setState(() {
});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(5),
border: OutlineInputBorder(borderSide: BorderSide.none)
),
),
)
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: 10,),
Text("Doviz *", style: _labelMandatoryStyle,),
],
),
InkWell(
onTap: ()async{
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetCurrencys",
target: "kod",
nonSearchable: true,
));
if(result==null)return;
_doviz = result['kod'];
setState(() {
});
},
child: Container(
padding: EdgeInsets.all(3),
margin: EdgeInsets.only(top: 5, left: 10),
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[600], width: 1)
),
child: Row(
children: <Widget>[
Expanded(
child: Text(_doviz??"", style: _valueStyle,),
),
Icon(Icons.arrow_drop_down, color: Colors.grey[600],)
],
)
),
)
],
),
),
],
),
),
],
),
),
),
),
)
),
],
),
)
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 0,
),
floatingActionButton: FloatingActionButton(
backgroundColor: !_active?Colors.blue.withOpacity(0.5):Color(0xFF007DB9),
onPressed: ()async{
if(!_active)
return;
try{
if(int.parse(_brutKgController.text) < int.parse(_netKgController.text)){
Toast.show("Net kg, Brüt kg'dan fazla olamaz.", context, duration: Toast.LENGTH_LONG, gravity: Toast.CENTER);
return;
}
}catch(e){
print(e.toString());
Toast.show("msg", context);
return;
}
//if(!await Dialogs.confirmDialog(context, "Are you sure?")) return;
setState(() {
_loading = true;
});
String _endpoint = "AddProduct";
var _params = {
"sirket_Id": Provider.of<NewDeclarationProvider>(context, listen:false).sekirtId,
"ref": widget.trnNumber,
"gtip": _gtip,
"net": int.parse(_netKgController.text),
"burut": int.parse(_brutKgController.text),
"gtipTanim": _tricariTanimController.text,
"rejimKodu": widget.declaration.rejimKodu,
"userId": UserRepository().user.id.toString(),
"fTutar": int.parse(_tutarController.text),
"fDoviz": _doviz
};
var result = await ApiHelper().doListPostRequest(_endpoint, _params);
var _kapParams = {
"sirket_Id": Provider.of<NewDeclarationProvider>(context, listen:false).sekirtId,
"ref": widget.trnNumber,
"kalem_No": 1,
"kapMarkaNo": "ADDR",
"kapTipi": "BI - Kap",
"kapAdet": 100,
"kalemSayisi": 1,
"kapMarkaNo_LNG": "TR",
"giris": UserRepository().user.id,
};
await ApiHelper().doListPostRequest("AddCase", _kapParams);
print(result);
int status = 1;
if(result.isEmpty)
status = 0;
Navigator.pop(context, status);
},
child: Icon(Icons.check),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/productListScreen.dart | import 'dart:io';
import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/products.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home/newDecleration/AddProductScreen.dart';
import 'package:tobbund/widgets/dialog.dart';
class ProductListScreen extends StatefulWidget {
String trnNumber;
Declaration declaration;
ProductListScreen({this.declaration, this.trnNumber});
@override
_ProductListScreenState createState() => _ProductListScreenState();
}
class _ProductListScreenState extends State<ProductListScreen> {
final GlobalKey<State> _keyLoader = GlobalKey<State>();
bool _isAdded = false;
final _titleStyle = TextStyle(color: Colors.grey);
final _bodyStyle = TextStyle(color: Colors.black);
Widget _itemWidget(Products _products, int number) {
return Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 20),
child: Card(
color: Colors.grey[100],
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"G.Tip",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.gtipNokta,
style: _bodyStyle,
),
),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
"Kalem No:",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
number.toString(),
style: _bodyStyle,
)
],
),
),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
"Parçalı:",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.parcali,
style: _bodyStyle,
)
],
),
),
],
)
],
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Ticari Tanım",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.tanim,
style: _bodyStyle,
),
),
],
),
),
],
),
SizedBox(
height: 30,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Kap Tipi",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.kapTipi ?? "",
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Kap Adet",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.kapAdet.toString() ?? "",
style: _bodyStyle,
)
],
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Brüt kg",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.brut.toString(),
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Net kg",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.net.toString(),
style: _bodyStyle,
)
],
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Tutar",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.tutar.toString(),
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Döviz",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.doviz,
style: _bodyStyle,
)
],
),
),
)
],
),
],
),
),
),
);
}
@override
Widget build(BuildContext context) {
return WillPopScope(child:Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("${widget.declaration.id} / ${widget.trnNumber} / Kalem", style: TextStyle(fontSize: 16),
),
),
body: Container(
padding: EdgeInsets.only(top: 10.0),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
color: Colors.grey[200],
height: 40,
margin: EdgeInsets.only(left: 10, right: 10),
child: Row(
children: <Widget>[
Expanded(child: Container(
alignment: Alignment.center,
child: Text("Beyan", style: TextStyle(color: Colors.grey[800]),),
)),
Expanded(child: Container(
color: Color(0xFF0B40A2),
alignment: Alignment.center,
child: Text("Kalem", style: TextStyle(color: Colors.white),),
)),
],
)),
Divider(
color: Colors.grey[700],
),
Container(
height: MediaQuery.of(context).size.height -
(Platform.isIOS ? 234 : 204),
child: FutureBuilder<List<Products>>(
future: _getData(), // a previously-obtained Future<String> or null
builder: (BuildContext context, AsyncSnapshot<List<Products>> snapshot) {
List<Widget> children;
if (snapshot.hasData) {
if(snapshot.data.isEmpty){
return Center(child: Container(
padding: EdgeInsets.all(20),
child: Material(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Container(
height: 200,
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.info_outline, color: Colors.blue, size: 45,),
SizedBox(height: 10,),
Container(
child: Text("Bilgi", style: TextStyle(color: Colors.grey, fontSize: 14),),
),
SizedBox(height: 10,),
Container(
width: double.infinity,
child: Text('Bu pozisyon içerisinde kalem yoktur.\nSağ alttaki \"artı\" butonundan kalem ekleyebilirsiniz.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.grey[700]),
),
),
],
),
),
),
)
);
}else{
children = List.generate(snapshot.data.length, (i) {
return _itemWidget(snapshot.data[i], i + 1);
});
}
} else if (snapshot.hasError) {
children = <Widget>[
Icon(
Icons.error_outline,
color: Colors.red,
size: 60,
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Text('Error: ${snapshot.error}'),
)
];
} else {
children = <Widget>[
SizedBox(
height: 10,
),
SizedBox(
child: CircularProgressIndicator(),
width: 30,
height: 30,
),
const Padding(
padding: EdgeInsets.only(top: 16),
child: Text('Sonuç bekleniyor..'),
)
];
}
return SingleChildScrollView(child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),);
},
),
),
],
),
)
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 1,
),
floatingActionButton: FloatingActionButton(
backgroundColor: _isAdded?Colors.blue[200]:Color(0xFF007DB9),
onPressed: ()async{
if(_isAdded)return;
int result = await Navigator.push(context, MaterialPageRoute(builder: (context)=>AddProductScreen(declaration: widget.declaration, trnNumber: widget.trnNumber,)));
if(result == 1){
_isAdded = true;
setState(() {
});
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: false,
title: "Başarılı!",
description: "Kalem oluşturuldu.",
icon: "success",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
}else{
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: true,
title: "Hata!",
description: "Kalem oluşturulamadı.",
icon: "failed",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
}
},
child: Icon(Icons.add),
),
), onWillPop: ()async{
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Çıkmak istediğinize emin misiniz?"))return false;
return true;
});
}
Future<List<Products>> _getData() async {
List<Products> _products = [];
const String endpoint = "GetProducts";
var params = {
"trnNumber": widget.trnNumber,
"sirketId": widget.declaration.sirketId,
};
var response = await ApiHelper().doListPostRequest(endpoint, params);
print(response);
for (var item in response) {
_products.add(Products.fromJson(item));
}
print(_products.length);
return _products;
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/searchDialogForCarrier.dart | import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:tobbund/model/company.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/repository/UserRepository.dart';
class SearchDialogForCarrier extends StatefulWidget {
final Map<String, dynamic> company;
SearchDialogForCarrier({this.company});
@override
_SearchDialogForCarrierState createState() => _SearchDialogForCarrierState();
}
class _SearchDialogForCarrierState extends State<SearchDialogForCarrier> {
final _searchController = new TextEditingController();
List<Company> _companies = [];
bool _isSearching = false;
bool _isLoading = false;
String _searchKey;
@override
void initState() {
// TODO: implement initState
super.initState();
_searchKey = "";
_search();
}
//Future _search(String _txt)async{
Future _search() async{
_isLoading = true;
_isSearching = true;
setState(() {
});
//Map<String, dynamic> _param = {"companyName": _txt, "firmId": UserRepository().user.sirketId};
Map<String, dynamic> _param = {
"companyName": _searchKey,
"firmId": widget.company['sirkatId']};
String _endpoint = "GetCarriers";
var response = await ApiHelper().doListPostRequest(_endpoint, _param);
_companies = [];
for(var item in response){
Company _company = new Company.fromJson(item);
_companies.add(_company);
}
_isSearching = false;
setState(() {
});
}
Widget _searchWidget(){
return TextField(
style: TextStyle(
color: Colors.black
),
autofocus: true,
controller: _searchController,
onChanged: (val)async{
if(val.length == 2){
_companies = [];
setState(() {
});
return;
}
if(val.length < 3)return;
_searchKey = val;
await _search();
},
decoration: InputDecoration(
hintText: "Taşıyıcı ara",
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
),
);
}
Widget _searchResultWidget(){
return Container(
child: _isSearching?
Container(
padding: EdgeInsets.all(30),
child: Text("Aranıyor...", style: TextStyle(
color: Colors.grey
),),
):Column(
children: _companies.map((data){
return
Container(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(height: 2,),
ListTile(
onTap: (){
Map<String, dynamic> company = {};
company['name'] = data.unvan;
company['id'] = data.id;
company['firmaId'] = data.sirketId;
Navigator.of(context).pop(company);
},
title: Text(data.unvan),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 10,),
Text("TR/VKN:${data.vergiNo}", style: TextStyle(fontSize: 12),),
SizedBox(height: 10,),
Text("${data.adres}")
],
),
),
SizedBox(height: 2,),
Container(
color: Colors.grey[300],
height: 1,
),
],
),
);
}).toList(),
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
children: <Widget>[
ListView(
children: <Widget>[
SizedBox(height: 50,),
_searchResultWidget(),
],
),
_searchWidget(),
],
)
);
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/searchDialogForCompany.dart | import 'package:flutter/material.dart';
import 'package:tobbund/model/company.dart';
import 'package:tobbund/controller/apiHelper.dart';
class SearchDialogForCompany extends StatefulWidget {
@override
_SearchDialogForCompanyState createState() => _SearchDialogForCompanyState();
}
class _SearchDialogForCompanyState extends State<SearchDialogForCompany> {
final _searchController = new TextEditingController();
List<Company> _companies = [];
bool _isSearching = false;
@override
void initState() {
// TODO: implement initState
super.initState();
}
Widget _searchWidget(){
return TextField(
style: TextStyle(
color: Colors.black
),
autofocus: true,
controller: _searchController,
onChanged: (val){
if(val.length == 2){
_companies = [];
setState(() {
});
return;
}
if(val.length < 3)return;
_search(val);
},
decoration: InputDecoration(
hintText: "Ara...",
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
),
);
}
Widget _searchResultWidget(){
return Container(
child: _isSearching?
Container(
padding: EdgeInsets.all(30),
child: Text("Aranıyor...", style: TextStyle(
color: Colors.grey
),),
):Column(
children: _companies.map((data){
return
Container(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(height: 2,),
ListTile(
onTap: (){
Map<String, dynamic> company = {};
company['name'] = data.unvan;
company['id'] = data.id;
company['firmaId'] = data.sirketId;
Navigator.of(context).pop(company);
},
title: Text(data.unvan),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 10,),
Text("TR/VKN:${data.sirketId}", style: TextStyle(fontSize: 12),),
SizedBox(height: 10,),
Text("${data.adres}")
],
),
),
SizedBox(height: 2,),
Container(
color: Colors.grey[300],
height: 1,
),
],
),
);
}).toList(),
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
children: <Widget>[
ListView(
children: <Widget>[
SizedBox(height: 50,),
_searchResultWidget(),
],
),
_searchWidget(),
],
)
);
}
_search(String _txt)async{
_isSearching = true;
setState(() {
});
Map<String, dynamic> _param = {"companyName": _txt};
String _endpoint = "GetCompanies";
_companies = [];
var response = await ApiHelper().doListPostRequest(_endpoint, _param);
for(var item in response){
Company _company = new Company.fromJson(item);
_companies.add(_company);
}
_isSearching = false;
setState(() {
});
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/dropdownDialogForTreyler.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:flutter/cupertino.dart';
import 'package:tobbund/repository/UserRepository.dart';
class DropdownDialogForTreyler extends StatefulWidget {
final Map<String, dynamic> company;
DropdownDialogForTreyler({this.company});
@override
_DropdownDialogForTreylerState createState() =>
_DropdownDialogForTreylerState();
}
class _DropdownDialogForTreylerState extends State<DropdownDialogForTreyler> {
List<Map<String, dynamic>> _licenses;
final _searchController = new TextEditingController();
bool _isLoading = false;
String _searchKey;
@override
void initState() {
// TODO: implement initState
super.initState();
_searchKey = "34";
_search();
}
Future _search() async {
_isLoading = true;
setState(() {});
Map<String, dynamic> param = {
"firmId": widget.company['firmaId'],
"company": widget.company['id'],
"type": 2,
"licensePlate": _searchKey
};
var response =
await ApiHelper().doListPostRequest('GetLicensePlates', param);
print(response);
_licenses = [];
for (var item in response) {
_licenses.add(item);
}
//print("0000000000000000000");
print(_licenses);
if (mounted)
setState(() {
_isLoading = false;
});
}
Widget _searchWidget() {
return TextField(
style: TextStyle(color: Colors.black),
autofocus: true,
controller: _searchController,
onChanged: (val) async {
_searchKey = val;
if (val.length == 0) _searchKey = "34";
await _search();
},
decoration: InputDecoration(
hintText: "Ara",
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
focusedBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
children: <Widget>[
ListView(
children: <Widget>[
SizedBox(
height: 50,
),
_isLoading
? Container(
height: 100,
child: Center(
child: CupertinoActivityIndicator(),
),
)
: (_licenses == null
? Container()
: Column(
mainAxisSize: MainAxisSize.min,
children: _licenses.map((val) {
return ListTile(
onTap: () {
Navigator.pop(context, val['plakaNo']);
//Navigator.pop(context, val['plaka']);
},
title: Text(val['plakaNo']),
//title: Text(val['plaka']),
);
}).toList(),
))
],
),
_searchWidget(),
],
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/dropdownDialogForCekici.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:flutter/cupertino.dart';
import 'package:tobbund/repository/UserRepository.dart';
class DropdownDialogForCekici extends StatefulWidget {
final Map<String, dynamic> company;
DropdownDialogForCekici({this.company});
@override
_DropdownDialogForCekiciState createState() =>
_DropdownDialogForCekiciState();
}
class _DropdownDialogForCekiciState extends State<DropdownDialogForCekici> {
List<Map<String, dynamic>> _licenses;
final _searchController = new TextEditingController();
bool _isLoading = false;
String _searchKey;
@override
void initState() {
// TODO: implement initState
super.initState();
_searchKey = "34";
_search();
}
Future _search() async {
_isLoading = true;
setState(() {});
Map<String, dynamic> param = {
"firmId": widget.company['firmaId'],
"company": widget.company['id'],
"type": 1,
"licensePlate": _searchKey
};
/*
Future _search() async {
_isLoading = true;
setState(() {});
Map<String, dynamic> param = {
"firmId": UserRepository().user.sirketId,
"company": UserRepository().user.firmaId,
"type": 1,
"licensePlate": _searchKey
};
*/
/*
if (_companyId != 1000) {
_companyName["name"] = UserRepository().user.ticaretUnvani;
_companyChange = false;
setState(() {});
}else{
_companyName["name"] == "";
_companyChange = true;
setState(() {});
}
*/
var response =
await ApiHelper().doListPostRequest('GetLicensePlates', param);
print(response);
_licenses = [];
for (var item in response) {
_licenses.add(item);
}
//print("0000000000000000000");
print(_licenses);
if (mounted)
setState(() {
_isLoading = false;
});
}
Widget _searchWidget() {
return TextField(
style: TextStyle(color: Colors.black),
autofocus: true,
controller: _searchController,
onChanged: (val) async {
_searchKey = val;
if (val.length == 0) _searchKey = "34";
await _search();
},
decoration: InputDecoration(
hintText: "Ara",
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.only(left: 10, right: 10),
enabledBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
focusedBorder:
UnderlineInputBorder(borderSide: BorderSide(color: Colors.black)),
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
child: Stack(
children: <Widget>[
ListView(
children: <Widget>[
SizedBox(
height: 50,
),
_isLoading
? Container(
height: 100,
child: Center(
child: CupertinoActivityIndicator(),
),
)
: (_licenses == null
? Container()
: Column(
mainAxisSize: MainAxisSize.min,
children: _licenses.map((val) {
return ListTile(
onTap: () {
Navigator.pop(context, val['plakaNo']);
//Navigator.pop(context, val['plaka']);
},
title: Text(val['plakaNo']),
//title: Text(val['plaka']),
);
}).toList(),
))
],
),
_searchWidget(),
],
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/dropdownDialogForTransmod.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:flutter/cupertino.dart';
class DropdownDialogForTransmod extends StatefulWidget {
@override
_DropdownDialogForTransmodState createState() =>
_DropdownDialogForTransmodState();
}
class _DropdownDialogForTransmodState extends State<DropdownDialogForTransmod> {
List<String> _transMod = [];
final Map<String, String> _tasimaModuMap = {
"UND": "UN RoRo",
"ULU": "Ulusoy",
"SLS":"Sea Lines"
};
@override
void initState() {
// TODO: implement initState
super.initState();
_init();
}
void _init() async {
var response =
await ApiHelper().doListPostRequest('GetTransportMode', null);
for (var item in response) {
if (item['kod'] == 'UND' || item['kod'] == 'ULU' || item['kod'] == 'SLS')
_transMod.add(item['kod']); // Burayi kod'a cevir.
}
setState(() {});
}
@override
Widget build(BuildContext context) {
return Dialog(
child: SingleChildScrollView(
child: _transMod.isEmpty
? Container(
height: 100,
child: Center(
child: CupertinoActivityIndicator(),
),
)
: Column(
mainAxisSize: MainAxisSize.min,
children: _transMod.map((val) {
return ListTile(
onTap: () {
Navigator.pop(context, val);
},
title: Text(_tasimaModuMap[val]),
);
}).toList(),
),
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/newDecleration/addDeclarationScreen.dart | import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tobbund/controller/new_declerations_provider.dart';
import 'package:tobbund/model/TRNItem.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/newdeclaration/countries.dart';
import 'package:tobbund/model/newdeclaration/customs.dart';
import 'package:tobbund/model/newdeclaration/firms.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home/newDecleration/productListScreen.dart';
import 'package:tobbund/screens/home/newDecleration/searchDropdownDialog.dart';
import 'package:tobbund/widgets/dialog.dart';
class AddDeclarationScreen extends StatefulWidget {
final Declaration declaration;
final TRNItem trnItem;
AddDeclarationScreen({this.declaration, this.trnItem});
@override
_AddDeclarationScreenState createState() => _AddDeclarationScreenState();
}
class _AddDeclarationScreenState extends State<AddDeclarationScreen> {
NewDeclarationProvider _newDeclarationProvider;
bool _checkActive = false;
final GlobalKey<State> _keyLoader = GlobalKey<State>();
Widget _hareketWidget() {
return Container(
padding: EdgeInsets.only(top: 5, bottom: 0, left: 10, right: 10),
child: Stack(
alignment: Alignment(-1.005, -1),
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
padding: EdgeInsets.only(top: 20, bottom: 40),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFF0B40A2), width: 1)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: ()async{
if(_newDeclarationProvider.trnNumber != null) return;
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetCustoms",
target: "gumrukTamTanim",
searchTarget: "searchCustom",
params: {
"searchCustom":""
},
));
if(result==null)return;
print(result);
_newDeclarationProvider.gumruk = Customs.fromJson(result);
setState(() {
});
},
child: _ItemWidget('Gümrük *', _newDeclarationProvider.gumruk?.gumrukTamTanim?? ""),
),
Divider(
color: Colors.grey,
),
InkWell(
onTap: ()async{
},
child: _ItemWidget('Ülke *', _newDeclarationProvider.gumruk?.ulkeKodu?? ""),
),
Divider(
color: Colors.grey,
),
InkWell(
onTap: ()async{
if(_newDeclarationProvider.trnNumber != null) return;
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetFirms",
target: "unvan",
searchTarget: "searchFirm",
params: {
//"firmId": 1007,
"firmId": _newDeclarationProvider.sekirtId,
"searchFirm": ""
}
));
if(result==null)return;
_newDeclarationProvider.gonderici = Firms.fromJson(result);
setState(() {
});
},
child: _ItemWidget('Gönderici *', _newDeclarationProvider.gonderici?.unvan ?? ""),
),
Divider(
color: Colors.grey,
),
_ItemWidget(
'Gönderici Adres *', _newDeclarationProvider.gonderici?.adres?? ""),
Divider(
color: Colors.grey,
),
Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text("Eşyanın Bulunduğu Yer", style: TextStyle(color: Colors.red[800]),),
Container(
height: 30,
child: TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
border: UnderlineInputBorder(
borderSide: BorderSide.none),
hintText: "",
hintStyle: TextStyle(
color: Colors.black87,
fontSize: 16,
fontWeight: FontWeight.w500),
),
),
)
],
)
),
],
),
),
Container(
width: 100,
padding: EdgeInsets.only(top: 5, bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
),
child: Text(
"Hareket",
style: TextStyle(
color: Color(0xFF0B40A2),
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
],
),
);
}
Widget _ItemWidget(String title, String subtitle) {
return Container(
padding: EdgeInsets.only(right: 10, left: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: TextStyle(color: Colors.red[800]),
),
SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
subtitle,
),
),
Icon(
Icons.arrow_drop_down,
color: Colors.grey,
)
],
),
],
),
);
}
Widget _varisWidget() {
return Container(
padding: EdgeInsets.only(top: 5, bottom: 20, left: 10, right: 10),
child: Stack(
alignment: Alignment(-1.005, -1),
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
padding: EdgeInsets.only(top: 20, bottom: 40),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFF0B40A2), width: 1)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: ()async{
if(_newDeclarationProvider.trnNumber != null) return;
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetCustoms",
target: "gumrukTamTanim",
searchTarget: "searchCustom",
params: {
"searchCustom":""
},
));
if(result==null)return;
print(result);
_newDeclarationProvider.varisGumruk = Customs.fromJson(result);
setState(() {
});
},
child:_ItemWidget(
'Transitin Son. Gümrüğü *', _newDeclarationProvider.varisGumruk?.gumrukTamTanim ?? ""),
),
Divider(
color: Colors.grey,
),
InkWell(
onTap: ()async{
},
child: _ItemWidget('Ülke *', _newDeclarationProvider.varisGumruk?.ulkeKodu ?? ""),
),
Divider(
color: Colors.grey,
),
InkWell(
onTap: ()async{
if(_newDeclarationProvider.trnNumber != null) return;
var result = await showDialog(context: context, builder: (context)=>SearchDropdownDialog(
endpoint: "GetFirms",
target: "unvan",
searchTarget: "searchFirm",
params: {
//"firmId": 1007,
"firmId" : _newDeclarationProvider.sekirtId,
"searchFirm": ""
}
));
if(result==null)return;
_newDeclarationProvider.alci = Firms.fromJson(result);
setState(() {
});
},
child: _ItemWidget('Alıcı *', _newDeclarationProvider.alci?.unvan ?? ""),
),
Divider(
color: Colors.grey,
),
_ItemWidget('Alıcı Adres *', _newDeclarationProvider.alci?.adres ?? ""),
],
),
),
Container(
width: 100,
padding: EdgeInsets.only(top: 5, bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
),
child: Text(
"Varış",
style: TextStyle(
color: Color(0xFF0B40A2),
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
],
),
);
}
@override
void initState() {
// TODO: implement initState
super.initState();
_newDeclarationProvider = Provider.of<NewDeclarationProvider>(context,listen: false);
_newDeclarationProvider.declaration = widget.declaration;
_newDeclarationProvider.init();
}
@override
Widget build(BuildContext context) {
_checkActive = _newDeclarationProvider.checkActive();
return WillPopScope(child: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("${widget.declaration.id} / Beyan", style: TextStyle(fontSize: 16),
),
),
body: Container(
padding: EdgeInsets.only(top: 10.0),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
color: Colors.grey[200],
height: 40,
margin: EdgeInsets.only(left: 10, right: 10),
child: Row(
children: <Widget>[
Expanded(child: Container(
color: Color(0xFF0B40A2),
alignment: Alignment.center,
child: Text("Beyan", style: TextStyle(color: Colors.white),),
)),
Expanded(child: Container(
alignment: Alignment.center,
child: Text("Kalem", style: TextStyle(color: Colors.grey[800]),),
)),
],
)),
Divider(
color: Colors.grey[700],
),
Container(
height: MediaQuery.of(context).size.height -
(Platform.isIOS ? 234 : 204),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
_hareketWidget(),
_varisWidget(),
]
),
)
),
],
),
)
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 1,
),
floatingActionButton: FloatingActionButton(
backgroundColor: !_checkActive?Colors.blue.withOpacity(0.5):Color(0xFF007DB9),
onPressed: ()async{
if(!_checkActive)return;
//if(!await Dialogs.confirmDialog(context, "Are you sure?")) return;
int status = await _newDeclarationProvider.addDeclaration();
if(status == 2){
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: false,
title: "Başarılı!",
description: "Beyan oluşturuldu.",
icon: "success",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
await Navigator.push(context, MaterialPageRoute(builder: (context)=>ProductListScreen(
declaration: _newDeclarationProvider.declaration, trnNumber: _newDeclarationProvider.trnNumber,
)));
_newDeclarationProvider.init();
setState(() {
});
}
if(status == 1){
Dialogs.showLoadingDialog(context,
key: _keyLoader,
barrierDismissible: false,
title: "Hata!",
description: "Pozisyon oluşturulamadı.",
icon: "failed",
);
await Future.delayed(Duration(seconds: 2));
Navigator.of(_keyLoader.currentContext,rootNavigator: true).pop();
}
return;
},
child: Icon(Icons.check),
),
), onWillPop: ()async{
if(!await Dialogs.confirmDialog(context, "Bilgiler kaydedilmedi. Çıkmak istediğinize emin misiniz?")) return false;
return true;
});
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerations/declerationPreviousDetailsPage.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/model/TRNItem.dart';
import 'package:tobbund/screens/home/newDecleration/addDeclarationScreen.dart';
import 'declerationDetailsPage.dart';
import 'package:tobbund/repository/UserRepository.dart';
class DeclerationPreviousDetailsPage extends StatefulWidget {
final List<TRNItem> trns;
final Declaration declaration;
DeclerationPreviousDetailsPage({this.trns, this.declaration});
@override
_DeclerationPreviousDetailsPageState createState() => _DeclerationPreviousDetailsPageState();
}
class _DeclerationPreviousDetailsPageState extends State<DeclerationPreviousDetailsPage> {
Widget _TRNItemWidget(TRNItem data){
return Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 0.6
)
)
),
child: InkWell(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder:
(context)=>
DeclerationDetailsPage(
trnNumber: data.ref,
lrn_mrn: data.lrn,
declaration: widget.declaration,
)
)
);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: 40,
height: 40,
child: Image.asset("assets/images/list.png", fit: BoxFit.cover,),
),
SizedBox(width: 20,),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Kayıt Numarası',
style: TextStyle(
color: Colors.grey
),
),
SizedBox(height: 2,),
Text('${data.ref}',
style: TextStyle(
fontSize: 16
),
),
SizedBox(height: 10,),
Text('LRN / MRN',
style: TextStyle(
color: Colors.grey
),
),
SizedBox(height: 2,),
Text('${data.lrn??""}',
style: TextStyle(
fontSize: 16
),
)
],
),
),
new Builder(builder: (context){
if(data.lrn == null || data.lrn == "")
return Container(
height: 30,
margin: EdgeInsets.only(bottom: 10
),
child: RaisedButton(
padding: EdgeInsets.all(0),
color: Color(0xFF007DB9),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>AddDeclarationScreen(declaration: widget.declaration, trnItem: data,)));
},
child: Row(
children: <Widget>[
Icon(Icons.edit, color: Colors.white70, size: 18,),
Text("Güncelle", style: TextStyle(color: Colors.white70, ),)
],
),
),
);
if(data.lrn.contains("LR"))
return Container(
height: 30,
margin: EdgeInsets.only(bottom: 10
),
child: RaisedButton(
padding: EdgeInsets.all(0),
color: Color(0xFF007DB9),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>AddDeclarationScreen(declaration: widget.declaration, trnItem: data,)));
},
child: Row(
children: <Widget>[
Icon(Icons.edit, color: Colors.white70, size: 18,),
Text("Güncelle", style: TextStyle(color: Colors.white70, ),)
],
),
),
);
return Container();
}),
],
),
),
);
}
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("${widget.declaration.id} / Beyan Listesi",
style: TextStyle(fontSize: 16),
),
),
body: widget.trns.isEmpty?
Center(
child: Container(
padding: EdgeInsets.all(20),
child: Material(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
),
child: Container(
height: 200,
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.info_outline, color: Colors.blue, size: 45,),
SizedBox(height: 10,),
Container(
child: Text("Bilgi", style: TextStyle(color: Colors.grey, fontSize: 14),),
),
SizedBox(height: 10,),
Container(
width: double.infinity,
child: Text('Bu pozisyon içerisinde beyan yoktur.\nSağ alttaki \"artı\" butonundan beyan ekleyebilirsiniz.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.grey[700]),
),
),
],
),
),
),
)
):
SingleChildScrollView(
child: Container(
child: Column(
children: widget.trns.map((data){
return _TRNItemWidget(data);
}).toList()
),
)
),
floatingActionButton: FloatingActionButton(
backgroundColor: Color(0xFF007DB9),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>AddDeclarationScreen(declaration: widget.declaration,)));
},
child: Icon(Icons.add),
),
bottomNavigationBar: BottomBarWidget(pageIndex: 0,)
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerations/zeroDetailsWidget.dart | import 'package:flutter/material.dart';
import 'package:tobbund/model/declaration.dart';
class ZeroDetailsWidget extends StatelessWidget {
final Declaration declaration;
final String trnNum;
ZeroDetailsWidget({this.declaration, this.trnNum});
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
color: Colors.grey[100],
child: Column(
children: <Widget>[
_detailsItemWidget(context, name: "Kayıt Numarası / TRN Numarası", value: "${declaration.id} / ${trnNum??"--"}", image:"assets/images/1.PNG"),
_detailsItemWidget(context, name: "Firma", value: "${declaration.firmaAd}", image:"assets/images/2.PNG"),
_detailsItemWidget(context, name: "Taşıyıcı", value: "${declaration.tasiyici}", image:"assets/images/3.PNG"),
_detailsItemWidget(context, name: "LRN / MRN", value: "${declaration.mrn??""}", image:"assets/images/4.PNG"),
_detailsItemWidget(context, name: "Arac Bilgileri", value: "Çekici : ${declaration.plaka} / Treyler : ${declaration.plaka2}", image:"assets/images/5.PNG"),
_detailsItemWidget(context, name: "Tarih", value: "${declaration.duzenliTarih}", image:"assets/images/6.PNG"),
_detailsItemWidget(context, name: "Taşıma Modu", value: "${declaration.tasimaMod}", image:"assets/images/icon4-tmode.png"),
_detailsItemWidget(context, name: "Beyan Türü", value: "${declaration.rejimKodu}", image:"assets/images/9.PNG"),
//_detailsItemWidget(context, name: "Beyan Sayısı", value: "${declaration.ensStatu}", image:"assets/images/9.PNG"),
_detailsItemWidget(context, name: "Beyan Sayısı", value: "", image:"assets/images/9.PNG"),
_detailsItemWidget(context, name: "Toplam Teminat", value: "", image:"assets/images/9.PNG"),
_detailsItemWidget(context, name: "Fiyat", value: "", image:"assets/images/9.PNG"),
_detailsItemWidget(context, name: "Konteyner No", value: "${declaration.konteynerNo}", image:"assets/images/icon8-container.png"),
_detailsItemWidget(context, name: "Toplam Kap", value: "", image:"assets/images/icon8-container.png"),
_detailsItemWidget(context, name: "Toplam kg", value: "", image:"assets/images/icon8-container.png"),
_detailsItemWidget(context, name: "Sefer Bilgisi", value: "", image:"assets/images/icon5-expedition.png"),
],
),
),
);
}
Widget _detailsItemWidget(BuildContext context, {@required String name, String value, String image}){
if(name == "Sefer Bilgisi")
return Container(
margin: EdgeInsets.only(top: 7, left: 10, right: 10),
padding: EdgeInsets.only(bottom: 5),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
)
)
),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Image.asset(image, width: 30,),
SizedBox(width: 10,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(name, style: TextStyle(
fontSize: 12,
color: Colors.grey[700]
),),
],
),
],
),
Container(
height: 100,
child: ListView(
scrollDirection: Axis.vertical,
children: <Widget>[
Table(
border: TableBorder.all(
color: Colors.black26, width: 1,),
children: [
TableRow( children: [
Column(children:[
Text('Gemi Adt', style: TextStyle(
color: Colors.blue[900],
fontWeight: FontWeight.bold,
fontSize: 12
),)
]),
Column(children:[
Text('Kalkis Tarl', style: TextStyle(
color: Colors.blue[900],
fontWeight: FontWeight.bold,
fontSize: 12
),)
]),
Column(children:[
Text('Kalkis Yeri', style: TextStyle(
color: Colors.blue[900],
fontWeight: FontWeight.bold,
fontSize: 12
),)
]),
Column(children:[
Text('Varis Tarihi', style: TextStyle(
color: Colors.blue[900],
fontWeight: FontWeight.bold,
fontSize: 12
),)
]),
Column(children:[
Text('Vans Yeri', style: TextStyle(
color: Colors.blue[900],
fontWeight: FontWeight.bold,
fontSize: 12
),)
]),
]),
TableRow( children: [
Container(
padding: EdgeInsets.only(top: 8, bottom: 5),
child: Center(
child: Text("Troy Seaways", textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
),),
Container(
padding: EdgeInsets.only(top: 8, bottom: 5),child:Center(
child: Text("16.06.2020", textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
),),
Container(
padding: EdgeInsets.only(top: 8, bottom: 5),child:Center(
child: Text("GPA", textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
),),
Container(
padding: EdgeInsets.only(top: 8, bottom: 5),child:Center(
child: Text("17.06.2020", textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
),),
Container(
padding: EdgeInsets.only(top: 8, bottom: 5),child:Center(
child: Text("PEN", textAlign: TextAlign.center, style: TextStyle(fontSize: 12),),
)),
]),
],
),
],
),
),
],
)
);
return Container(
margin: EdgeInsets.only(top: 7
, left: 10, right: 10),
padding: EdgeInsets.only(bottom: 5),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.grey,
width: 0.7
)
)
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(image, width: 30,),
SizedBox(width: 10,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(name, style: TextStyle(
fontSize: 12,
color: Colors.grey[700]
),),
SizedBox(height: 5,),
Container(
width: MediaQuery.of(context).size.width-70,
child: Text(value, style: TextStyle(
fontSize: 14
),),
),
],
)
],
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerations/secondDetailsWidget.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/products.dart';
import 'package:tobbund/repository/UserRepository.dart';
class SecondDetailsWidget extends StatefulWidget {
final String trnNumber;
final Declaration declaration;
SecondDetailsWidget(this.trnNumber, this.declaration);
@override
_SecondDetailsWidgetState createState() => _SecondDetailsWidgetState();
}
class _SecondDetailsWidgetState extends State<SecondDetailsWidget> {
final _titleStyle = TextStyle(color: Colors.grey);
final _bodyStyle = TextStyle(color: Colors.black);
Widget _itemWidget(Products _products, int number) {
return Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 20),
child: Card(
color: Colors.grey[100],
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"G.Tip",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.gtipNokta,
style: _bodyStyle,
),
),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
"Kalem No:",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
number.toString(),
style: _bodyStyle,
)
],
),
),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text(
"Parçalı:",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.parcali,
style: _bodyStyle,
)
],
),
),
],
)
],
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Ticari Tanım",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.tanim,
style: _bodyStyle,
),
),
],
),
),
],
),
SizedBox(
height: 30,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Kap Tipi",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.kapTipi ?? "",
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Kap Adet",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.kapAdet.toString() ?? "",
style: _bodyStyle,
)
],
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Brüt kg",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.brut.toString(),
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Net kg",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.net.toString(),
style: _bodyStyle,
)
],
),
),
)
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Tutar",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Container(
width: double.infinity,
child: Text(
_products.tutar.toString(),
style: _bodyStyle,
),
),
],
),
),
Expanded(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Döviz",
style: _titleStyle,
),
SizedBox(
height: 5,
),
Text(
_products.doviz,
style: _bodyStyle,
)
],
),
),
)
],
),
],
),
),
),
);
}
@override
Widget build(BuildContext context) {
return FutureBuilder<List<Products>>(
future: _getData(), // a previously-obtained Future<String> or null
builder: (BuildContext context, AsyncSnapshot<List<Products>> snapshot) {
List<Widget> children;
if (snapshot.hasData) {
children = List.generate(snapshot.data.length, (i) {
return _itemWidget(snapshot.data[i], i + 1);
});
} else if (snapshot.hasError) {
children = <Widget>[
Icon(
Icons.error_outline,
color: Colors.red,
size: 60,
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Text('Error: ${snapshot.error}'),
)
];
} else {
children = <Widget>[
SizedBox(
height: 10,
),
SizedBox(
child: CircularProgressIndicator(),
width: 30,
height: 30,
),
const Padding(
padding: EdgeInsets.only(top: 16),
child: Text('Sonuç bekleniyor..'),
)
];
}
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),
);
},
);
}
Future<List<Products>> _getData() async {
List<Products> _products = [];
const String endpoint = "GetProducts";
// var params = {
// "trnNumber": widget.refNumber,
// "firmId": UserRepository().user.sirketId
// };
var params = {
"trnNumber": widget.trnNumber,
"sirketId": widget.declaration.sirketId,
};
var response = await ApiHelper().doListPostRequest(endpoint, params);
print(response);
for (var item in response) {
_products.add(Products.fromJson(item));
}
print(_products.length);
return _products;
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerations/firstDetailsWidget.dart | import 'package:flutter/material.dart';
import 'package:tobbund/controller/apiHelper.dart';
import 'package:tobbund/model/declaration.dart';
import 'package:tobbund/model/positionDetails.dart';
import 'package:tobbund/repository/UserRepository.dart';
class FirstDetailsWidget extends StatefulWidget {
final String trnNumber;
final Declaration declaration;
FirstDetailsWidget(this.trnNumber, this.declaration);
@override
_FirstDetailsWidgetState createState() => _FirstDetailsWidgetState();
}
class _FirstDetailsWidgetState extends State<FirstDetailsWidget> {
Widget _hareketWidget(PositionDetails _positionDetails) {
return Container(
padding: EdgeInsets.only(top: 5, bottom: 0, left: 10, right: 10),
child: Stack(
alignment: Alignment(-1.005, -1),
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
padding: EdgeInsets.only(top: 20, bottom: 40),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFF0B40A2), width: 1)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_ItemWidget('Gümrük', _positionDetails.hareketGumrugu ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget('Ülke', _positionDetails.hareketUlkesi ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget('Gönderici', _positionDetails.gonderici ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget(
'Gönderici Adres', _positionDetails.gondericiAdres ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget(
'Eşyanın Bulunduğu Yer', "", false),
],
),
),
Container(
width: 100,
padding: EdgeInsets.only(top: 5, bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
),
child: Text(
"Hareket",
style: TextStyle(
color: Color(0xFF0B40A2),
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
],
),
);
}
Widget _ItemWidget(String title, String subtitle, bool editable) {
return Container(
padding: EdgeInsets.only(right: 10, left: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: TextStyle(color: Colors.grey),
),
SizedBox(
height: 5,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
subtitle,
),
),
editable?Icon(
Icons.arrow_drop_down,
color: Colors.grey,
):Container()
],
),
],
),
);
}
Widget _varisWidget(PositionDetails _positionDetails) {
return Container(
padding: EdgeInsets.only(top: 5, bottom: 20, left: 10, right: 10),
child: Stack(
alignment: Alignment(-1.005, -1),
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 15, bottom: 15),
padding: EdgeInsets.only(top: 20, bottom: 40),
decoration: BoxDecoration(
border: Border.all(color: Color(0xFF0B40A2), width: 1)),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
_ItemWidget(
'Son Gümrük', _positionDetails.transitinSonGumrugu ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget('Ülke', _positionDetails.gidecegiUlke ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget('Alıcı', _positionDetails.alici ?? "", true),
Divider(
color: Colors.grey,
),
_ItemWidget('Alıcı Adres', _positionDetails.aliciAdres ?? "", true),
],
),
),
Container(
width: 100,
padding: EdgeInsets.only(top: 5, bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
),
child: Text(
"Varış",
style: TextStyle(
color: Color(0xFF0B40A2),
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return FutureBuilder<List<PositionDetails>>(
future: _getData(), // a previously-obtained Future<String> or null
builder: (BuildContext context,
AsyncSnapshot<List<PositionDetails>> snapshot) {
List<Widget> children;
if (snapshot.hasData) {
children = snapshot.data
.map((data) => Column(
children: <Widget>[
_hareketWidget(data),
_varisWidget(data),
],
))
.toList();
} else if (snapshot.hasError) {
children = <Widget>[
Icon(
Icons.error_outline,
color: Colors.red,
size: 60,
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Text('Error: ${snapshot.error}'),
)
];
} else {
children = <Widget>[
SizedBox(
height: 10,
),
SizedBox(
child: CircularProgressIndicator(),
width: 30,
height: 30,
),
const Padding(
padding: EdgeInsets.only(top: 16),
child: Text('Sonuç bekleniyor..'),
)
];
}
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),
);
},
);
}
Future<List<PositionDetails>> _getData() async {
List<PositionDetails> _PositionDetails = [];
const String endpoint = "GetPositionDetails";
var params = {
"trnNumber": widget.trnNumber,
"firmId": widget.declaration.sirketId
};
var response = await ApiHelper().doListPostRequest(endpoint, params);
print(response);
for (var item in response) {
_PositionDetails.add(PositionDetails.fromJson(item));
}
print(_PositionDetails.length);
return _PositionDetails;
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens/home | mirrored_repositories/flutter-delivery-mvp/lib/screens/home/declerations/declerationDetailsPage.dart | import 'package:flutter/material.dart';
import 'package:tobbund/screens/bottombar.dart';
import 'package:tobbund/screens/home/declerations/zeroDetailsWidget.dart';
import 'firstDetailsWidget.dart';
import 'secondDetailsWidget.dart';
import 'dart:io' show Platform;
import 'package:tobbund/model/declaration.dart';
class DeclerationDetailsPage extends StatefulWidget {
final String trnNumber;
final String lrn_mrn;
Declaration declaration;
DeclerationDetailsPage({this.trnNumber, this.lrn_mrn, this.declaration});
@override
_DeclerationDetailsPageState createState() => _DeclerationDetailsPageState();
}
class _DeclerationDetailsPageState extends State<DeclerationDetailsPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
Widget _tabWidget() {
return Container(
child: DefaultTabController(
length: 3,
child: Column(
children: <Widget>[
Container(
color: Colors.grey[200],
height: 40,
margin: EdgeInsets.only(left: 10, right: 10),
child: TabBar(
controller: _tabController,
labelColor: Colors.white,
unselectedLabelColor: Colors.black,
labelPadding: EdgeInsets.all(0),
indicatorPadding: EdgeInsets.all(0),
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xFF0B40A2),
border: Border.all(color: Colors.grey)),
indicatorWeight: 1,
tabs: [
Tab(
child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10),
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
right:
BorderSide(color: Colors.white, width: 2))),
child: Text("Is Emri"),
),
),
Tab(
child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10),
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
right:
BorderSide(color: Colors.white, width: 2))),
child: Text("Beyanname"),
),
),
Tab(
child: Container(
padding: EdgeInsets.only(top: 10, bottom: 10),
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
right:
BorderSide(color: Colors.white, width: 2))),
child: Text("Kalem"),
),
),
],
)),
Divider(
color: Colors.grey[700],
),
Container(
height: MediaQuery.of(context).size.height -
(Platform.isIOS ? 231 : 204),
child: TabBarView(controller: _tabController, children: [
ZeroDetailsWidget(declaration: widget.declaration, trnNum: widget.trnNumber,),
FirstDetailsWidget(widget.trnNumber, widget.declaration),
SecondDetailsWidget(widget.trnNumber, widget.declaration),
]),
),
],
),
),
);
}
@override
void initState() {
// TODO: implement initState
super.initState();
_tabController = TabController(vsync: this, length: 3);
_tabController.addListener(() {
print("Listen");
print(_tabController.index);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_tabController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Beyan Detayı"),
),
body: Container(
child: Column(children: <Widget>[
SizedBox(height: 10,),
_tabWidget()
]),
),
bottomNavigationBar: BottomBarWidget(
pageIndex: 0,
));
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/administrativeFunctionsScreen.dart | import 'package:flutter/material.dart';
class AdministrativeFunctionsScreen extends StatefulWidget {
@override
_AdministrativeFunctionsScreenState createState() => _AdministrativeFunctionsScreenState();
}
class _AdministrativeFunctionsScreenState extends State<AdministrativeFunctionsScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Yönetsel İşlevler"),
),
);
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/registrationProcedures.dart | import 'package:flutter/material.dart';
class RegistrationProcedures extends StatefulWidget {
@override
_RegistrationProceduresState createState() => _RegistrationProceduresState();
}
class _RegistrationProceduresState extends State<RegistrationProcedures> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Tescil İşlemleri"),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/helpScreen.dart | import 'package:flutter/material.dart';
class HelpScreen extends StatefulWidget {
@override
_HelpScreenState createState() => _HelpScreenState();
}
class _HelpScreenState extends State<HelpScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Help"),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/settingScreen.dart | import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:tobbund/screens/home.dart';
class SettingScreen extends StatefulWidget {
@override
_SettingScreenState createState() => _SettingScreenState();
}
class Languages {
int id;
String lang;
Languages(this.id, this.lang);
static List<Languages> getLanguages(){
return <Languages>[
Languages(0, 'Türkçe'),
Languages(1, 'İngilizce'),
Languages(2, 'Almanca'),
Languages(3, 'Fransızca'),
Languages(4, 'Bulgarca'),
Languages(5, 'Rusça'),
Languages(6, 'İtalyanca'),
Languages(7, 'Macarca'),
Languages(8, 'Slovence'),
Languages(9, 'Sırpça'),
Languages(10, 'Romence'),
];
}
}
class _SettingScreenState extends State<SettingScreen> {
bool _value = false;
void _onChanged(bool value){
setState(() {
_value = value;
});
}
List<Languages> _languages = Languages.getLanguages();
List<DropdownMenuItem<Languages>> _dropdownMenuItems;
Languages _selectedLanguage;
@override
void initState() {
_dropdownMenuItems = buildDropdownMenuItems(_languages);
_selectedLanguage = _dropdownMenuItems[0].value;
super.initState();
}
List<DropdownMenuItem<Languages>> buildDropdownMenuItems(List langs) {
List<DropdownMenuItem<Languages>> items = List();
for (Languages lang in langs) {
items.add(
DropdownMenuItem(
value: lang,
child: Text(lang.lang),
),
);
}
return items;
}
onChangeDropdownItem(Languages selectedLanguages) {
setState(() {
_selectedLanguage = selectedLanguages;
});
}
// Widget _ButtonsField() {
// // End //
// return Container(
// margin: EdgeInsets.symmetric(vertical: 20),
// child: Column(
// children: <Widget>[
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Container(
// height: 40,
// width: 120,
// child: FlatButton(
// color: Colors.green,
// onPressed: (){},
// child: Text("Kaydet", style: TextStyle(color: Colors.white, fontSize: 18, fontFamily: "Helvetica"),),
// ),
// ),
// ],
// ),
// ],
// ),
// );
// }
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Ayarlar", style: TextStyle(fontFamily: "Verdana"),),
leading: GestureDetector(
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => HomeScreen()));
},
child: Icon(
Icons.arrow_back_ios,
),
),
actions: <Widget>[
Padding(
padding: EdgeInsets.only(right: 20.0),
child: GestureDetector(
onTap: () {
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => SecondDetailsDeclerationPage()));
},
child: Icon(
Icons.check,
size: 28.0,
),
)),
],
),
body: SingleChildScrollView(
// padding: const EdgeInsets.all(5.0),
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Dil seçeneği kodları
// Text("Dil Seçiniz"),
// SizedBox(height: 30.0,),
// DropdownButton(
// value: _selectedLanguage,
// items: _dropdownMenuItems,
// onChanged: onChangeDropdownItem,
// ),
Text(
'Mail Bildirimleri',
textAlign: TextAlign.center,
style: TextStyle(fontFamily: "Verdana Bold", color: Color(0xFF187EA0), fontSize: 20.0, height: 3.0),
),
new SwitchListTile(
title: new Text("Yeni müşteri onaylandığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Yeni yurtdışı beyan girişinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan geçici tescil (LRN) aldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan LRN aldığında TAD dokümanını PDF olarak gönder", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan hata aldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("@Destek Talebi Açıldı - Bildir", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan iptal edildiğinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("ENS hata aldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("ENS tescil aldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Araç hareket gümrüğünde serbest bırakıldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Araç sınır geçişi yaptığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Araç varış yaptığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan ibra edildiğinde (kapandığında)", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Yeni “Açık Beyan” kaydı oluştuğunda", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Açık olan beyan kapandığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("İş ortağı ekleme talebinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Araç ekleme talebinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Hesaba ödeme girişinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Hesaba avans/kredi girişinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Bakiye azaldığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Bakiye bittiğinde", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("İş ortağı onaylandığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Araç onaylandığında", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Beyan Düzeltme Takip", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
new SwitchListTile(
title: new Text("Teminat Değişimi Olduğunda", style: TextStyle(fontFamily: "Verdana"),),
value: _value,
onChanged: (bool value){_onChanged(value);}
),
// new SwitchListTile(
// title: new Text("Araç hareket gümrüğünde serbest bırakıldığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Araç sınır geçişi yaptığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Araç varış yaptığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Beyan ibra edildiğinde (kapandığında)"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Yeni “Açık Beyan” kaydı oluştuğunda"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Açık olan beyan kapandığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("İş ortağı ekleme talebinde"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Araç ekleme talebinde"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Hesaba ödeme girişinde"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Hesaba avans/kredi girişinde"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Bakiye azaldığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Bakiye bittiğinde"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("İş ortağı onaylandığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Araç onaylandığında"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Beyan Düzeltme Takip"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// new SwitchListTile(
// title: new Text("Teminat Değişimi Olduğunda"),
// value: _value,
// activeColor: Colors.green,
// onChanged: (bool value){_onChanged(value);}
// ),
// _ButtonsField(),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/helpSupportScreen.dart | import 'package:flutter/material.dart';
class HelpSupportScreen extends StatefulWidget {
@override
_HelpSupportScreenState createState() => _HelpSupportScreenState();
}
class _HelpSupportScreenState extends State<HelpSupportScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Yardım ve Destek", style: TextStyle(fontFamily: "Verdana"),),
),
body: ListView.builder(
itemCount: data.length,
itemBuilder: (BuildContext context, int index) => EntryItem(data[index],),
),
);
}
}
class Entry {
final String title;
final List <Entry>
children;
Entry(this.title, [this.children = const <Entry>[]]);
}
final List<Entry> data = <Entry>[
Entry(
'T1',
<Entry>[
Entry('Lorem Ipsum, dizgi ve baskı endüstrisinde kullanılan mıgır metinlerdir. Lorem Ipsum, adı bilinmeyen bir matbaacının bir hurufat numune kitabı oluşturmak üzere bir yazı galerisini alarak karıştırdığı 1500lerden beri endüstri standardı sahte metinler olarak kullanılmıştır.',),
]
),
Entry(
'T2',
<Entry>[
Entry('Lorem Ipsum, dizgi ve baskı endüstrisinde kullanılan mıgır metinlerdir. Lorem Ipsum, adı bilinmeyen bir matbaacının bir hurufat numune kitabı oluşturmak üzere bir yazı galerisini alarak karıştırdığı 1500lerden beri endüstri standardı sahte metinler olarak kullanılmıştır.',),
]
),
Entry(
'ENS',
<Entry>[
Entry('Lorem Ipsum, dizgi ve baskı endüstrisinde kullanılan mıgır metinlerdir. Lorem Ipsum, adı bilinmeyen bir matbaacının bir hurufat numune kitabı oluşturmak üzere bir yazı galerisini alarak karıştırdığı 1500lerden beri endüstri standardı sahte metinler olarak kullanılmıştır.',),
]
)
];
class EntryItem extends StatelessWidget {
const EntryItem(this.entry);
final Entry entry;
// This function recursively creates the multi-level list rows.
Widget _buildTiles(Entry root) {
if (root.children.isEmpty) {
return ListTile(
title: Text(root.title, style: TextStyle(fontFamily: "Verdana"),),
);
}
return ExpansionTile(
key: PageStorageKey<Entry>(root),
title: Text(root.title, style: TextStyle(fontFamily: "Verdana"),),
children: root.children.map<Widget>(_buildTiles).toList(),
);
}
@override
Widget build(BuildContext context) {
return _buildTiles(entry);
}
} | 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/registrationScreen.dart | import 'package:flutter/material.dart';
class RegistrationScreen extends StatefulWidget {
@override
_RegistrationScreenState createState() => _RegistrationScreenState();
}
class _RegistrationScreenState extends State<RegistrationScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Registration"),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/regulationScreen.dart | import 'package:flutter/material.dart';
class RegulationScreen extends StatefulWidget {
@override
_RegulationScreenState createState() => _RegulationScreenState();
}
class _RegulationScreenState extends State<RegulationScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Tarife ve Mevzuat"),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/reportScreen.dart | import 'package:flutter/material.dart';
import 'package:tobbund/screens/home.dart';
class ReportScreen extends StatefulWidget {
@override
_ReportScreenState createState() => _ReportScreenState();
}
class _ReportScreenState extends State<ReportScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Raporlar", style: TextStyle(fontFamily: "Verdana"),),
leading: GestureDetector(
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => HomeScreen()));
},
child: Icon(
Icons.arrow_back_ios,
),
),
actions: <Widget>[
Padding(
padding: EdgeInsets.only(right: 20.0),
child: GestureDetector(
onTap: () {
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => SecondDetailsDeclerationPage()));
},
child: Icon(
Icons.check,
size: 28.0,
),
)),
],
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp/lib/screens | mirrored_repositories/flutter-delivery-mvp/lib/screens/sidebarItemScreens/accountScreen.dart | import 'package:flutter/material.dart';
import 'package:tobbund/repository/UserRepository.dart';
class AccountScreen extends StatefulWidget {
@override
_AccountScreenState createState() => _AccountScreenState();
}
class _AccountScreenState extends State<AccountScreen> {
final _companyController = new TextEditingController();
final _nameSurnameController = new TextEditingController();
final _emailController = new TextEditingController();
final _authorityLevelController = new TextEditingController();
@override
void initState() {
_companyController.text = UserRepository().user.ticaretUnvani;
_nameSurnameController.text = UserRepository().user.adiSoyadi;
_emailController.text = UserRepository().user.email;
if (UserRepository().user.yetkiDuzeyi == 1 &&
UserRepository().user.superUser == false) {
_authorityLevelController.text = "Standart Kullanıcı";
} else if (UserRepository().user.yetkiDuzeyi == 2 &&
UserRepository().user.superUser == false) {
_authorityLevelController.text = "Yetkili Kullanıcı";
} else if (UserRepository().user.yetkiDuzeyi == 3 &&
UserRepository().user.superUser == false) {
_authorityLevelController.text = "Üst Düzey Kullanıcı";
} else {
_authorityLevelController.text = "Admin Kullanıcı";
}
super.initState();
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF187EA0),
title: Text("Hesabım", style: TextStyle(fontFamily: "Verdana"),),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: ListView(
physics: NeverScrollableScrollPhysics(),
children: [
TextField(
controller: _companyController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(Icons.business),
labelText: "Firma",
),
),
TextField(
controller: _nameSurnameController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(Icons.account_box),
labelText: 'İsim - Soyisim',
),
),
TextField(
controller: _emailController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(Icons.alternate_email),
labelText: 'E - Posta',
),
),
TextField(
controller: _authorityLevelController,
enabled: false,
style: TextStyle(fontFamily: "Verdana"),
decoration: InputDecoration(
icon: Icon(Icons.grade),
labelText: 'Yetki Düzeyi',
),
)]),
),
);
}
}
| 0 |
mirrored_repositories/flutter-delivery-mvp | mirrored_repositories/flutter-delivery-mvp/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tobbund/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/JOB-CO | mirrored_repositories/JOB-CO/lib/generated_plugin_registrant.dart | //
// Generated file. Do not edit.
//
// ignore_for_file: lines_longer_than_80_chars
import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
FirebaseFirestoreWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
| 0 |
mirrored_repositories/JOB-CO | mirrored_repositories/JOB-CO/lib/main.dart | import 'package:dsc/ui/contactus.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:dsc/ui/jobhome.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:dsc/constants/constants.dart';
import 'package:dsc/ui/signin.dart';
import 'package:dsc/ui/signup.dart';
import 'package:dsc/ui/splashscreen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:provider/provider.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({Key key}) : super(key: key);
//final Future<FirebaseApp> _fbApp = Firebase.initializeApp();
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "Login",
theme: ThemeData(primaryColor: Colors.orange[200]),
routes: <String, WidgetBuilder>{
SPLASH_SCREEN: (BuildContext context) => SplashScreen(),
SIGN_IN: (BuildContext context) => SignInPage(),
SIGN_UP: (BuildContext context) => SignUpScreen(),
DASHBOARD: (BuildContext context) => Dashboard(),
CONTACTUS: (BuildContext context) => Contact(),
JOBHOME: (BuildContext context) => HomePage(),
},
initialRoute: SPLASH_SCREEN,
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/constants/constants.dart | final String SIGN_IN = 'signin';
final String SIGN_UP = 'signup';
final String SPLASH_SCREEN = 'splashscreen';
final String DASHBOARD = 'dashboard';
final String ABOUT = 'about';
final String CONTACTUS = 'contactus';
final String JOBHOME = 'jobhome';
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/utils/operations.dart | import 'package:cloud_firestore/cloud_firestore.dart';
Future<void> uploadingData(
String _jobName, String _salary, String _imageUrl, bool isApproved) async {
await FirebaseFirestore.instance.collection("jobs").add({
'jobName': _jobName,
'salary': _salary,
'imageUrl': _imageUrl,
'isApproved': isApproved,
});
}
Future<void> editProduct(bool isApproved, String id) async {
await FirebaseFirestore.instance
.collection("jobs")
.doc(id)
.update({"isApproved": !isApproved});
}
Future<void> deleteProduct(DocumentSnapshot doc) async {
await FirebaseFirestore.instance.collection("jobs").doc(doc.id).delete();
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/utils/validator.dart | class Validator {
String validateName(String value) {
String pattern = r'(^[a-zA-Z ]*$)';
RegExp regExp = new RegExp(pattern);
if (value.length == 0) {
return "Name is Required";
} else if (!regExp.hasMatch(value)) {
return "Name must be a-z and A-Z";
}
return null;
}
String validateMobile(String value) {
String pattern = r'(^[0-9]*$)';
RegExp regExp = new RegExp(pattern);
if (value.length == 0) {
return "Mobile is Required";
} else if (value.length != 10) {
return "Mobile number must 10 digits";
} else if (!regExp.hasMatch(value)) {
return "Mobile Number must be digits";
}
return null;
}
String validatePasswordLength(String value){
if(value.length==0){
return "Password can't be empty";
} else if (value.length < 10){
return "Password must be longer than 10 characters";
}
return null;
}
String validateEmail(String value) {
String pattern =
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
RegExp regExp = new RegExp(pattern);
if (value.length == 0) {
return "Email is Required";
} else if (!regExp.hasMatch(value)) {
return "Invalid Email";
} else {
return null;
}
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/complete_page.dart | import 'package:dsc/ui/Update_Profile.dart';
import 'package:dsc/ui/appli_status.dart';
import 'package:dsc/ui/applynow.dart';
import 'package:dsc/ui/business.dart';
import 'package:dsc/ui/contactus.dart';
import 'package:dsc/ui/customerdash.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:dsc/ui/shops.dart';
import 'package:dsc/ui/signin.dart';
import 'package:dsc/ui/signup.dart';
import 'package:dsc/ui/profile.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:provider/provider.dart';
class AuthenticationProvider {
final FirebaseAuth firebaseAuth;
// FirebaseAuth instance
AuthenticationProvider(this.firebaseAuth);
//Constructor to initialize the Firebase Auth instance.
Stream<User> get authStateChanges => firebaseAuth.idTokenChanges();
Future<void> signOut() async {
await firebaseAuth.signOut();
}
}
class Random extends StatefulWidget {
@override
_RandomState createState() => _RandomState();
}
class _RandomState extends State<Random> {
var user = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
// to get size
//var size = MediaQuery.maybeOf(context).size;
// style
var cardTextStyle = TextStyle(
fontFamily: "Montserrat Regular",
fontSize: 14,
color: Color.fromRGBO(63, 63, 63, 1));
return Scaffold(
// body: Stack(
// children: <Widget>[
backgroundColor: Colors.indigo[900],
// Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/top_header.jpg'),
// fit: BoxFit.fill),
// ),
// ),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
elevation: 20,
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Status()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
// alignment: Alignment.topRight,
Image.asset('assets/images/jobs.jpg', height: 90),
Text(
'Appli_sta',
style: cardTextStyle,
),
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Apply()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/application.png',
height: 128,
),
Text(
'Applynow',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (BuildContext context) =>
BDashboard()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Busiines',
style: cardTextStyle,
),
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Contact()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Contact',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => CDashboard()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Customerdash',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Dashboard()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Dashboard',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Contact()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Contact',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Profile()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'profile',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Shop1()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'shop',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => UProfile()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Update profile',
style: cardTextStyle,
)
],
),
),
),
],
),
),
],
),
),
),
);
// ignore: dead_code
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/profile.dart | import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/customappbar.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:edge_alert/edge_alert.dart';
import 'package:firebase_image/firebase_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart' as Path;
import 'dart:io' as io;
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
final firestore = FirebaseFirestore.instance;
enum UploadType {
/// Uploads a randomly generated string (as a file) to Storage.
string,
/// Uploads a file from the device.
file,
/// Clears any tasks from the list.
clear,
}
class Profile extends StatefulWidget {
Profile({Key key}) : super(key: key);
@override
_ProfileState createState() => _ProfileState();
}
class _ProfileState extends State<Profile> {
final messagetextcontroller = TextEditingController();
List<firebase_storage.UploadTask> _uploadTasks = [];
bool checkBoxValue = false;
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
bool signingup = false;
GlobalKey<FormState> _key = GlobalKey();
// var name, email, photoUrl, uid, emailVerified, phnum;
String _email, name, phnum;
Widget dataname, datacontact, dataemail;
final auth = FirebaseAuth.instance;
Future<firebase_storage.UploadTask> uploadFile(PickedFile file) async {
if (file == null) {
EdgeAlert.show(context,
title: 'No file was selected',
description: "Please select image to upload",
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
return null;
}
firebase_storage.UploadTask uploadTask;
final User user = auth.currentUser;
final uid = user.uid;
// Create a Reference to the file
firebase_storage.Reference ref = firebase_storage.FirebaseStorage.instance
.ref()
.child('user_image')
.child('/$uid.jpg');
final metadata = firebase_storage.SettableMetadata(
contentType: 'image/jpeg',
customMetadata: {'picked-file-path': file.path});
if (kIsWeb) {
uploadTask = ref.putData(await file.readAsBytes(), metadata);
} else {
uploadTask = ref.putFile(io.File(file.path), metadata);
}
return Future.value(uploadTask);
}
Future<void> _downloadLink(firebase_storage.Reference ref) async {
final link = await ref.getDownloadURL();
await Clipboard.setData(ClipboardData(
text: link,
));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
'Success!\n Copied download URL to Clipboard!',
)));
}
Widget firedata() {
//BuildContext context
var firebaseUser = FirebaseAuth.instance.currentUser;
return new StreamBuilder(
stream: FirebaseFirestore.instance
.collection('users')
.doc(firebaseUser.uid)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return new Text("Loading");
}
var userDocument = snapshot.data;
return new Text(
userDocument["name"],
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: "Montserrat Medium"),
);
});
}
Widget firedata1() {
//BuildContext context
var firebaseUser = FirebaseAuth.instance.currentUser;
return new StreamBuilder(
stream: FirebaseFirestore.instance
.collection('users')
.doc(firebaseUser.uid)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return new Text("Loading");
}
var userDocument = snapshot.data;
return new Text(
userDocument["email"],
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: "Montserrat Medium"),
);
});
}
Widget firedata2() {
//BuildContext context
var firebaseUser = FirebaseAuth.instance.currentUser;
return new StreamBuilder(
stream: FirebaseFirestore.instance
.collection('users')
.doc(firebaseUser.uid)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return new Text("Loading");
}
var userDocument = snapshot.data;
return new Text(
userDocument["contact"],
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontFamily: "Montserrat Medium"),
);
});
}
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Scaffold(
body: Container(
height: _height,
width: _width,
margin: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Opacity(opacity: 0.88, child: CustomAppBar()),
clipShape(),
// form(),
SizedBox(
height: _height / 35,
),
form(),
button(),
],
),
),
),
),
);
}
Widget clipShape() {
final auth = FirebaseAuth.instance;
final User user = auth.currentUser;
final uid = user.uid;
return Stack(
children: <Widget>[
Opacity(
opacity: 0.75,
child: ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: _large
? _height / 8
: (_medium ? _height / 7 : _height / 6.5),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Opacity(
opacity: 0.5,
child: ClipPath(
clipper: CustomShapeClipper2(),
child: Container(
height: _large
? _height / 12
: (_medium ? _height / 11 : _height / 10),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Container(
height: _height / 5.5,
alignment: Alignment.center,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
spreadRadius: 0.0,
color: Colors.black26,
offset: Offset(1.0, 10.0),
blurRadius: 20.0),
],
color: Colors.white,
shape: BoxShape.circle,
),
child: GestureDetector(
onTap: () async {
PickedFile file =
await ImagePicker().getImage(source: ImageSource.gallery);
firebase_storage.UploadTask task = await uploadFile(file);
if (task != null) {
setState(() {
_uploadTasks = [..._uploadTasks, task];
});
}
print('Adding photo');
},
child: Image(
image: FirebaseImage(
'gs://job-co.appspot.com/user_image/$uid.jpg',
shouldCache: true, // The image should be cached (default: True)
maxSizeBytes: 3000 * 1000, // 3MB max file size (default: 2.5MB)
//cacheRefreshStrategy: CacheRefreshStrategy.NEVER,
),
// Works with standard parameters, e.g.
fit: BoxFit.cover,
width: 100,
height: 100,
// ... etc.
),
),
),
],
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 15.0),
child: Form(
key: _key,
child: Column(
children: <Widget>[
firedata(),
SizedBox(height: _height / 40.0),
firedata1(),
SizedBox(height: _height / 40.0),
firedata2(),
SizedBox(height: _height / 40.0),
],
),
),
);
}
Widget acceptTermsTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 100.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Checkbox(
activeColor: Colors.blue[400],
value: checkBoxValue,
onChanged: (bool newValue) {
setState(() {
checkBoxValue = newValue;
});
}),
Text(
"I accept all terms and conditions",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: _large ? 12 : (_medium ? 13 : 10)),
),
],
),
);
}
Widget infoTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 40.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Or create using social media",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: _large ? 12 : (_medium ? 11 : 10)),
),
],
),
);
}
Widget button() {
return RaisedButton(
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
final User user = auth.currentUser;
final uid = user.uid;
Reference ref = FirebaseStorage.instance
.ref()
.child('user_image')
.child('$uid.jpg');
String url = (await ref.getDownloadURL()).toString();
print("helloworld");
print(url);
firestore.collection("users").doc('$uid').update({
"uid": uid,
"photo": url,
});
Navigator.push(
context, new MaterialPageRoute(builder: (context) => Dashboard()));
// }
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
// height: _height / 20,
width: _large ? _width / 4 : (_medium ? _width / 2.75 : _width / 3.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'UPDATE PROFILE',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
),
);
}
} | 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/jobhome.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dsc/ui/jobItem.dart';
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
static const routeName = 'homePage';
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
String id;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Job List"),
backgroundColor:
Colors.white,
),
body: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection("jobs").snapshots(),
builder: (context, snapshot) {
return !snapshot.hasData
? Center(child: CircularProgressIndicator())
: ListView.builder(
itemCount: snapshot.data.docs.length,
itemBuilder: (context, index) {
DocumentSnapshot data = snapshot.data.docs[index];
return ProductItem(
documentSnapshot: data,
id: data.id,
isApproved: data['isApproved'],
imageUrl: data['imageUrl'],
jobName: data['jobName'],
salary: data['salary'],
);
},
);
},
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/shops.dart | import 'package:dsc/ui/dashboard.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
class Shop1 extends StatefulWidget {
@override
_Shop1 createState() => _Shop1();
}
class _Shop1 extends State<Shop1> {
bool value1 = false;
bool value2 = false;
bool value3 = false;
bool value4 = false;
bool value5 = false;
bool value6 = false;
bool value7 = false;
bool value8 = false;
bool value9 = false;
bool value10 = false;
bool value11 = false;
bool value12 = false;
String status, status2, status3, status4, status5, status6;
@override
Widget build(BuildContext context) {
// to get size
//var size = MediaQuery.maybeOf(context).size;
// style
Widget stat() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status = val;
},
// controller: name,
);
}
Widget stat2() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status2 = val;
},
// controller: name,
);
}
Widget stat3() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status3 = val;
},
// controller: name,
);
}
Widget stat4() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status4 = val;
},
// controller: name,
);
}
Widget stat5() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status5 = val;
},
// controller: name,
);
}
Widget stat6() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Approve/Reject",
userTyped: (val) {
status6 = val;
},
// controller: name,
);
}
Widget button() {
return RaisedButton(
elevation: 0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () {
Navigator.push(context,
new MaterialPageRoute(builder: (context) => Dashboard()));
// }
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
// height: _height / 20,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(7.0),
child: Text(
'UPDATE',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 10,
),
),
));
}
var cardTextStyle = TextStyle(
fontFamily: "Montserrat Regular",
fontSize: 14,
color: Color.fromRGBO(63, 63, 63, 1));
return Scaffold(
// body: Stack(
// children: <Widget>[
backgroundColor: Colors.indigo[900],
// Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/top_header.jpg'),
// fit: BoxFit.fill),
// ),
// ),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Text('Applicants',
style: TextStyle(fontSize: 30, color: Colors.white)),
/*Container(
height: 64,
margin: EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 32,
backgroundImage: AssetImage('assets/images/download.jpg'),
),
SizedBox(
width: 16,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${user.displayName}' ,
style: TextStyle(
fontFamily: "Montserrat Medium",
color: Colors.white,
fontSize: 20),
),
Text(
'${user.email}',
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: "Montserrat Regular"),
)
],
)
],
),
),
Align(
alignment: Alignment.bottomRight,
// ignore: deprecated_member_use
child: RaisedButton(
onPressed: () async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => SignInPage()),
(Route<dynamic> route) => false);
},
)),*/
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// alignment: Alignment.topRight,
Image.asset('assets/images/download.jpg', height: 28),
Text(
'ApplicantName_1',
style: cardTextStyle,
),
stat(),
SizedBox(height: 15.0), button()
],
),
),
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 28,
),
Text(
'ApplicantName_2',
style: cardTextStyle,
),
stat2(),
SizedBox(height: 15.0),
button()
],
),
),
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 28,
),
Text(
'ApplicantName_3',
style: cardTextStyle,
),
stat3(),
SizedBox(height: 15.0),
button()
],
),
),
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 28,
),
Text(
'ApplicantName_4',
style: cardTextStyle,
),
stat4(),
SizedBox(height: 15.0),
button()
],
),
),
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 28,
),
Text(
'ApplicantName_5',
style: cardTextStyle,
),
stat5(),
SizedBox(height: 15.0),
button()
],
),
),
Card(
elevation: 20,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 28,
),
Text(
'ApplicantName_6',
style: cardTextStyle,
),
stat6(),
SizedBox(height: 15.0),
button()
],
),
),
],
),
),
],
),
),
),
);
// ignore: dead_code
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/jobdetails.dart | //import 'dart:html';
import 'dart:core';
import 'package:dsc/ui/dashboard.dart';
import 'package:dsc/utils/operations.dart';
import 'package:flutter/material.dart';
import 'package:dsc/constants/constants.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/customappbar.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:edge_alert/edge_alert.dart';
//import 'package:modal_progress_hud/modal_progress_hud.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class JobDetials extends StatefulWidget {
@override
_JobdetailsState createState() => _JobdetailsState();
}
class _JobdetailsState extends State<JobDetials> {
bool checkBoxValue = false;
String id;
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
bool signingup = false;
bool isApproved;
String jobName, location, vacancy, salary,imageurl;
final firestore = FirebaseFirestore.instance;
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Scaffold(
body: Container(
height: _height,
width: _width,
margin: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Opacity(opacity: 0.88, child: CustomAppBar()),
clipShape(),
form(),
// acceptTermsTextRow(),
// SizedBox(
// height: _height / 35,
// ),
button(),
// infoTextRow(),
//socialIconsRow(),
//signInTextRow(),
],
),
),
),
),
);
}
Widget clipShape() {
return Stack(
children: <Widget>[ Container(
height: 64,
margin: EdgeInsets.only(left: 20, top:35, right: 20, bottom:0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircleAvatar(
radius: 42,
child: Image.asset( 'assets/images/shops.jpeg',
fit: BoxFit.cover,
),
// 'https://firebasestorage.googleapis.com/v0/b/dscsolution-80cbc.appspot.com/o/User_image%2FEtFMTsMQISXtMa9zOzgGB5DGguT2.jpg?alt=media&token=7b5c4569-7690-4a4f-9c0e-97a5dc564ea9'),
),
SizedBox(
width: 16,
),
],
),
),
],
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 20.0),
child: Form(
child: Column(
children: <Widget>[
firstNameTextFormField(),
SizedBox(height: _height / 30.0),
// lastNameTextFormField(),
SecondNameTextFormField(),
SizedBox(height: _height / 30.0),
emailTextFormField(),
SizedBox(height: _height / 30.0),
acceptTermsTextRow(),
SizedBox(height: _height / 20.0),
// SizedBox(height: _height / 60.0),
// passwordTextFormField(),
],
),
),
);
}
Widget firstNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.business_center_rounded,
hint: "Job Name",
userTyped: (val) {
jobName = val;
},
// controller: name,
);
}
// ignore: non_constant_identifier_names
Widget SecondNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.number,
icon: Icons.mobile_friendly,
hint: "Salary",
userTyped: (val) {
salary = val;
},
// controller: name,
);
}
Widget emailTextFormField() {
return /*TextField(
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(hintText: 'Email'),
onChanged: (value) {
setState(() {
_email = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.location_on,
hint: "imageurl",
userTyped: (val) {
imageurl = val;
}
//controller: email,
);
}
Widget acceptTermsTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 100.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Checkbox(
activeColor: Colors.blue[400],
value: checkBoxValue,
onChanged: (bool newValue) {
setState(() {
checkBoxValue = newValue;
isApproved = newValue;
});
}),
Text(
"Is Approved",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: _large ? 12 : (_medium ? 13 : 10)),
),
],
),
);
}
Widget button() {
return RaisedButton(
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (jobName != null )
{
setState(() {
signingup = true;
});
try {
// Map <String,dynamic> data= {"name":name.text,"email":email.text,"contact":phnum.text};
// FirebaseFirestore.instance.collection("users").doc("collection").set(data);
// if (newUser != null) {
firestore.collection("jobs").add({
"jobName": jobName,
"salary": salary,
"isApproved": isApproved,
"imageUrl": imageurl,
}).then((value) {
print(value.id);
});
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => Dashboard()));
// }
} catch (e) {
setState(() {
signingup = false;
});
EdgeAlert.show(context,
title: 'Signup Failed',
description: e.toString(),
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
} else {
EdgeAlert.show(context,
title: 'Signup Failed',
description:
'All fields are required. Accept all terms and conditions',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
// height: _height / 20,
width: _large ? _width / 4 : (_medium ? _width / 2.75 : _width / 3.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'APPLY',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
),
);
}
} //end of signup | 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/jobItem.dart | import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dsc/utils/operations.dart';
import 'package:flutter/material.dart';
class ProductItem extends StatefulWidget {
final String jobName;
final String salary;
final String imageUrl;
final bool isApproved;
final String id;
final DocumentSnapshot documentSnapshot;
ProductItem({
@required this.imageUrl,
@required this.documentSnapshot,
@required this.id,
@required this.isApproved,
@required this.jobName,
@required this.salary,
});
@override
_ProductItemState createState() => _ProductItemState();
}
class _ProductItemState extends State<ProductItem> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: double.infinity,
child: Row(
children: <Widget>[
Container(
height: 100,
width: 100,
child: ClipRRect(
borderRadius: BorderRadius.circular(60),
child: Image.network(
widget.imageUrl,
fit: BoxFit.cover,
),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
widget.jobName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 25),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text("Rs. ${widget.salary}",
style:
TextStyle(color: Colors.white, fontSize: 20)),
)
],
crossAxisAlignment: CrossAxisAlignment.start,
),
Row(
children: <Widget>[
IconButton(
onPressed: () {
editProduct(widget.isApproved, widget.id);
},
icon: widget.isApproved
? Icon(
Icons.check_circle_rounded, //after click
color: Colors.lightBlueAccent,
)
: Icon(
Icons.pending_actions_rounded,
color: Colors.lightBlueAccent,
),
),
IconButton(
onPressed: () {
deleteProduct(widget.documentSnapshot);
},
icon: Icon(
Icons.close,
color: Colors.white,
),
),
],
),
],
),
),
],
),
padding: EdgeInsets.all(10),
decoration:BoxDecoration(borderRadius: BorderRadius.circular(200),
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.indigo[900]],
),
),
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/applynow.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Apply extends StatefulWidget {
Apply({Key key}) : super(key: key);
@override
_ApplyState createState() => _ApplyState();
}
class _ApplyState extends State<Apply> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: shopprofileView()// This trailing comma makes auto-formatting nicer for build methods.
);
}
Widget shopprofileView() {
return Column(
children: <Widget>[
Padding(
padding: EdgeInsets.fromLTRB(30, 50, 30, 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Amul Shop', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),),
Container(height: 24,width: 24)
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0,0 ,60),
child: Stack(
children: <Widget>[
CircleAvatar(
radius: 70,
child: ClipOval(child: Image.asset('assets/images/download.jpg', height: 140, width: 140, fit: BoxFit.cover,)),
),
Positioned(bottom: 1, right: 1 ,child: Container(
height: 30, width: 30,
child: Icon(Icons.add_a_photo, color: Colors.white,),
decoration: BoxDecoration(
color: Colors.deepOrange,
borderRadius: BorderRadius.all(Radius.circular(20))
),
))
],
),
),
Expanded(child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(26), topRight: Radius.circular(26)),
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [Colors.lightBlueAccent, Color.fromRGBO(0, 42, 103, 1)]
)
),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(21, 25, 21, 4),
child: Container(
height: 55,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Text('Amul Shop', style: TextStyle(color: Colors.white70)),
),
), decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(18))),
),//,border: Border.all(width: 1.0, color: Colors.white70)
),
Padding(
padding: const EdgeInsets.fromLTRB(21, 5, 21, 4),
child: Container(
height: 55,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Text('Email:amul@gmail.com', style: TextStyle(color: Colors.white70)),
),
), decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(18))),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(21, 5, 21, 4),
child: Container(
height: 55,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Text('Available slots:15 only', style: TextStyle(color: Colors.white70)),
),
), decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(18))),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(21, 5, 21, 4),
child: Container(
height: 70,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Location: Near Sbi, vijaya vittal nagar ', style: TextStyle(color: Colors.white70)),
),
), decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(18))),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(21, 5, 21, 4),
child: Container(
height: 55,
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Text('Phone number:9475558858', style: TextStyle(color: Colors.white70),),
),
), decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(18))),
),
),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
child: Container( height: 50, width: 200,
child: Align(child: Text('Apply now', style: TextStyle(color: Colors.white70, fontSize: 20),),),
decoration: BoxDecoration(
color: Colors.deepOrange,
borderRadius: BorderRadius.only(topLeft: Radius.circular(30), bottomLeft: Radius.circular(30),bottomRight: Radius.circular(30), topRight: Radius.circular(30)
) ),
),
),
)
],
),
))
],
);
}
} | 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/customerdash.dart | import 'package:dsc/ui/appli_status.dart';
import 'package:dsc/ui/contactus.dart';
import 'package:dsc/ui/shops.dart';
import 'package:dsc/ui/signin.dart';
import 'package:dsc/ui/signup.dart';
import 'package:dsc/ui/profile.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:provider/provider.dart';
class AuthenticationProvider {
final FirebaseAuth firebaseAuth;
// FirebaseAuth instance
AuthenticationProvider(this.firebaseAuth);
//Constructor to initialize the Firebase Auth instance.
Stream<User> get authStateChanges => firebaseAuth.idTokenChanges();
Future<void> signOut() async {
await firebaseAuth.signOut();
}
}
class CDashboard extends StatefulWidget {
@override
_CDashboardState createState() => _CDashboardState();
}
class _CDashboardState extends State<CDashboard> {
var user = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
// to get size
//var size = MediaQuery.maybeOf(context).size;
// style
var cardTextStyle = TextStyle(
fontFamily: "Montserrat Regular",
fontSize: 14,
color: Color.fromRGBO(63, 63, 63, 1));
return Scaffold(
// body: Stack(
// children: <Widget>[
backgroundColor: Colors.indigo[900],
// Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/top_header.jpg'),
// fit: BoxFit.fill),
// ),
// ),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Container(
height: 64,
margin: EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 32,
child:Image.network('https://firebasestorage.googleapis.com/v0/b/dscsolution-80cbc.appspot.com/o/User_image%2FEtFMTsMQISXtMa9zOzgGB5DGguT2.jpg?alt=media&token=7b5c4569-7690-4a4f-9c0e-97a5dc564ea9'),
),
SizedBox(
width: 16,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${user.displayName}',
style: TextStyle(
fontFamily: "Montserrat Medium",
color: Colors.white,
fontSize: 20),
),
Text(
'${user.email}',
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: "Montserrat Regular"),
)
],
)
],
),
),
Align(
alignment: Alignment.bottomRight,
// ignore: deprecated_member_use
child: RaisedButton(
onPressed: () async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => SignInPage()),
(Route<dynamic> route) => false);
},
child:
const Text('Signout', style: TextStyle(fontSize: 20)),
color: Colors.blueAccent,
textColor: Colors.white,
elevation: 5,
)),
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
child: FlatButton(
onPressed: () async {
DocumentSnapshot variable = await FirebaseFirestore
.instance
.collection('users')
.doc('1fyyIIbwKiRhBm84JMYXZla7mmA3')
.get()
.then((data) async {
var dataReceive = data['name'];
print(dataReceive['name']);
});
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Profile()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Profile',
style: cardTextStyle,
),
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Contact()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Contact',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Status()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Application Status',
style: cardTextStyle,
)
],
),
),
),
],
),
),
],
),
),
),
);
// ignore: dead_code
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/business.dart | import 'package:dsc/ui/contactus.dart';
import 'package:dsc/ui/shops.dart';
import 'package:dsc/ui/signin.dart';
import 'package:dsc/ui/signup.dart';
import 'package:dsc/ui/profile.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:provider/provider.dart';
class AuthenticationProvider {
final FirebaseAuth firebaseAuth;
// FirebaseAuth instance
AuthenticationProvider(this.firebaseAuth);
//Constructor to initialize the Firebase Auth instance.
Stream<User> get authStateChanges => firebaseAuth.idTokenChanges();
Future<void> signOut() async {
await firebaseAuth.signOut();
}
}
class BDashboard extends StatefulWidget {
@override
_BDashboardState createState() => _BDashboardState();
}
class _BDashboardState extends State<BDashboard> {
var user = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
// to get size
//var size = MediaQuery.maybeOf(context).size;
// style
var cardTextStyle = TextStyle(
fontFamily: "Montserrat Regular",
fontSize: 14,
color: Color.fromRGBO(63, 63, 63, 1));
return Scaffold(
// body: Stack(
// children: <Widget>[
backgroundColor: Colors.indigo[900],
// Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/images/top_header.jpg'),
// fit: BoxFit.fill),
// ),
// ),
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Container(
height: 64,
margin: EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 32,
child:Image.network('https://firebasestorage.googleapis.com/v0/b/dscsolution-80cbc.appspot.com/o/User_image%2FEtFMTsMQISXtMa9zOzgGB5DGguT2.jpg?alt=media&token=7b5c4569-7690-4a4f-9c0e-97a5dc564ea9'),
),
SizedBox(
width: 16,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'${user.displayName}',
style: TextStyle(
fontFamily: "Montserrat Medium",
color: Colors.white,
fontSize: 20),
),
Text(
'${user.email}',
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: "Montserrat Regular"),
)
],
)
],
),
),
Align(
alignment: Alignment.bottomRight,
// ignore: deprecated_member_use
child: RaisedButton(
onPressed: () async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => SignInPage()),
(Route<dynamic> route) => false);
},
child:
const Text('Signout', style: TextStyle(fontSize: 20)),
color: Colors.blueAccent,
textColor: Colors.white,
elevation: 5,
)),
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Shop1()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/application.png',
height: 128,
),
Text(
'Shops',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () async {
DocumentSnapshot variable = await FirebaseFirestore
.instance
.collection('users')
.doc(
'1fyyIIbwKiRhBm84JMYXZla7mmA3') //change to dynamic
.get()
.then((data) async {
var dataReceive = data['name'];
print(dataReceive['name']);
});
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Profile()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Profile',
style: cardTextStyle,
),
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Contact()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Contact',
style: cardTextStyle,
)
],
),
),
),
Card(
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => SignUpScreen()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 128,
),
Text(
'Random',
style: cardTextStyle,
)
],
),
),
),
],
),
),
],
),
),
),
);
// ignore: dead_code
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/appli_status.dart | import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/customappbar.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:edge_alert/edge_alert.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart' as Path;
import 'dart:io' as io;
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
class Status extends StatefulWidget {
Status({Key key}) : super(key: key);
@override
_StatusState createState() => _StatusState();
}
class _StatusState extends State<Status> {
bool checkBoxValue = false;
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
bool signingup = false;
// var name, email, photoUrl, uid, emailVerified, phnum;
String _email, name, phnum;
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[300], Colors.yellowAccent],
),
),
height: _height,
width: _width,
margin: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Opacity(opacity: 0.88, child: CustomAppBar()),
form(),
SizedBox(
height: _height / 25,
),
],
),
),
),
),
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 20.0),
child:Card(
elevation: 20,shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Form(
child: Column(
children: <Widget>[
Text('Application Status',
style:TextStyle(fontSize: 30, fontWeight: FontWeight.bold, color: Color(0xff73A1F9)) ),
SizedBox(height: _height / 80.0),
Text('ShopName',textAlign: TextAlign.left,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: _height / 60.0),
Text('Approval Status',textAlign: TextAlign.left,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: _height / 60.0),
Text('Approved/Rejected',textAlign: TextAlign.left,
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: _height / 60.0),
],
),
),
));
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/splashscreen.dart | import 'dart:async';
//import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:dsc/constants/constants.dart';
import 'package:firebase_auth/firebase_auth.dart';
class AuthenticationProvider {
final FirebaseAuth firebaseAuth;
// FirebaseAuth instance
AuthenticationProvider(this.firebaseAuth);
//Constructor to initialize the Firebase Auth instance.
Stream<User> get authStateChanges => firebaseAuth.idTokenChanges();
}
class SplashScreen extends StatefulWidget {
@override
SplashScreenState createState() => new SplashScreenState();
}
class SplashScreenState extends State<SplashScreen>
with SingleTickerProviderStateMixin {
var _visible = true;
AnimationController animationController;
Animation<double> animation;
startTime() async {
var _duration = new Duration(seconds: 3);
return new Timer(_duration, navigationPage);
}
void navigationPage() {
FirebaseAuth.instance.authStateChanges().listen((User user) {
if (user == null) {
print('User is currently signed out!');
Navigator.of(context).pushReplacementNamed(SIGN_IN);
} else {
print('User is signed in!');
Navigator.of(context).pushReplacementNamed(DASHBOARD);
}
});
//Navigator.of(context).pushReplacementNamed(SIGN_IN);
}
@override
void initState() {
super.initState();
animationController = new AnimationController(
vsync: this, duration: new Duration(seconds: 3));
animation =
new CurvedAnimation(parent: animationController, curve: Curves.easeOut);
animation.addListener(() => this.setState(() {}));
animationController.forward();
setState(() {
_visible = !_visible;
});
startTime();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: <Widget>[
new Column(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Padding(
// padding: EdgeInsets.only(bottom: 30.0),
// child: new Image.asset(
// 'assets/images/powered_by.png',
// height: 25.0,
// fit: BoxFit.scaleDown,
// )
// )
// ],
),
new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Image.asset(
'assets/images/job.png',
width: animation.value * 250,
height: animation.value * 250,
),
],
),
],
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/signin.dart | import 'package:dsc/ui/business.dart';
import 'package:dsc/ui/customerdash.dart';
import 'package:edge_alert/edge_alert.dart';
import 'package:flutter/material.dart';
import 'package:dsc/constants/constants.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'dashboard.dart';
class SignInPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SignInScreen(),
);
}
}
class SignInScreen extends StatefulWidget {
@override
_SignInScreenState createState() => _SignInScreenState();
}
class _SignInScreenState extends State<SignInScreen> {
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
String _email;
String _password;
String dropdownValue = 'Customer';
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
GlobalKey<FormState> _key = GlobalKey();
// String _email, _password;
final auth = FirebaseAuth.instance;
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Container(
height: _height,
width: _width,
padding: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
clipShape(),
welcomeTextRow(),
signInTextRow(),
form(),
forgetPassTextRow(),
button2(), //button3(),button(),
signUpTextRow(), // signUpTextRow1(),
],
),
),
),
);
}
Widget clipShape() {
//double height = MediaQuery.of(context).size.height;
return Stack(
children: <Widget>[
Opacity(
opacity: 0.75,
child: ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: _large
? _height / 4
: (_medium ? _height / 3.75 : _height / 3.5),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Opacity(
opacity: 0.5,
child: ClipPath(
clipper: CustomShapeClipper2(),
child: Container(
height: _large
? _height / 4.5
: (_medium ? _height / 4.25 : _height / 4),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[700], Colors.yellowAccent],
),
),
),
),
),
Container(
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(
top: _large
? _height / 30
: (_medium ? _height / 25 : _height / 20)),
child: Image.asset(
'assets/images/job.png',
height: _height / 3.5,
width: _width / 3.5,
),
),
],
);
}
Widget welcomeTextRow() {
return Container(
margin: EdgeInsets.only(left: _width / 20, top: _height / 100),
child: Row(
children: <Widget>[
Text(
"Job&Co.",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: _large ? 60 : (_medium ? 50 : 40),
),
),
],
),
);
}
Widget signInTextRow() {
return Container(
margin: EdgeInsets.only(left: _width / 15.0),
child: Row(
children: <Widget>[
Text(
"Login to your account",
style: TextStyle(
fontWeight: FontWeight.w200,
fontSize: _large ? 20 : (_medium ? 17.5 : 15),
),
),
],
),
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 15.0),
child: Form(
key: _key,
child: Column(
children: <Widget>[
emailTextFormField(),
SizedBox(height: _height / 40.0),
passwordTextFormField(), SizedBox(height: _height / 40.0),
// user_busi(), SizedBox(height: _height / 40.0),
],
),
),
);
}
Widget emailTextFormField() {
return /*TextField(
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(hintText: 'Email'),
onChanged: (value) {
setState(() {
_email = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.emailAddress,
textEditingController: emailController,
icon: Icons.email,
color: Colors.blue.shade400,
hint: "Email ID",
userTyped: (val) {
_email = val;
});
}
Widget passwordTextFormField() {
return /*TextField(
obscureText: true,
decoration: InputDecoration(hintText: 'Password'),
onChanged: (value) {
setState(() {
_password = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.emailAddress,
textEditingController: passwordController,
icon: Icons.lock,
obscureText: true,
hint: "Password",
// decoration: InputDecoration(hintText: 'Password'),
userTyped: (val) {
_password = val;
});
}
// Widget user_busi() {
// return DropdownButton<String>(
// value: dropdownValue,
// icon: const Icon(Icons.arrow_downward),
// onChanged: (String newValue) {
// setState(() {
// dropdownValue = newValue;
// });
// },
// items: <String>['Customer', 'Bussiness']
// .map<DropdownMenuItem<String>>((String value) {
// return DropdownMenuItem<String>(
// value: value,
// child: Text(value),
// );
// }).toList(),
// );
// }
Widget forgetPassTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 40.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Forgot your password?",
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () async {
if (_email != null) {
auth.sendPasswordResetEmail(email: _email).then((_) {
EdgeAlert.show(context,
title: 'Password Rest Link Sent!!!',
description: 'Please find the restlink in your mail.',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
// Scaffold.of(context).showSnackBar(SnackBar(
// content:
// Text('PASSWORD Rest link has sent to your email.')));
});
print("Routing");
} else {
EdgeAlert.show(context,
title: 'Email required.',
description:
'Password reset link will be sent to Your email please provide correct email',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
child: Text(
"Recover",
style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.blue[900]),
),
)
],
),
);
}
Widget button2() {
return RaisedButton(
elevation: 0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (_password != null && _email != null) {
await auth
.signInWithEmailAndPassword(email: _email, password: _password)
.then((_) {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (BuildContext context) => Dashboard()),(Route<dynamic> route) => false);
});
// Navigator.of(context).pushNamed(LOGIN); //new line
print("Routing to your account");
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text('Wrong ID OR Password')));
} else {
EdgeAlert.show(context,
title: 'Login Failed',
description: 'All fields are required.',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
width: _large ? _width / 5 : (_medium ? _width / 2.75 : _width / 1.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'LOGIN ',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 14 : 10)),
),
));
}
Widget signUpTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 120.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Don't have an account?",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(SIGN_UP);
print("Routing to Sign up screen");
},
child: Text(
"Sign up",
style: TextStyle(
fontWeight: FontWeight.w900,
color: Colors.blue[900],
fontSize: _large ? 19 : (_medium ? 17 : 15)),
),
)
],
),
);
}
Widget button() {
return RaisedButton(
elevation: 0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (_password != null && _email != null) {
await auth
.signInWithEmailAndPassword(email: _email, password: _password)
.then((_) {
Navigator.push(context,
new MaterialPageRoute(builder: (context) => BDashboard()));
});
// Navigator.of(context).pushNamed(LOGIN); //new line
print("Routing to your account");
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text('Wrong ID OR Password')));
} else {
EdgeAlert.show(context,
title: 'Login Failed',
description: 'All fields are required.',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
width: _large ? _width / 5 : (_medium ? _width / 2.75 : _width / 1.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'LOGIN bussiness',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 14 : 10)),
),
));
}
Widget button3() {
return RaisedButton(
elevation: 0,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (_password != null && _email != null) {
await auth
.signInWithEmailAndPassword(email: _email, password: _password)
.then((_) {
Navigator.push(context,
new MaterialPageRoute(builder: (context) => Dashboard()));
});
// Navigator.of(context).pushNamed(LOGIN); //new line
print("Routing to your account");
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text('Wrong ID OR Password')));
} else {
EdgeAlert.show(context,
title: 'Login Failed',
description: 'All fields are required.',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
width: _large ? _width / 5 : (_medium ? _width / 2.75 : _width / 1.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'LOGIN main dsh',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 14 : 10)),
),
));
}
Widget signUpTextRow1() {
return Container(
margin: EdgeInsets.only(top: _height / 120.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Don't have an account business?",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(SIGN_UP);
print("Routing to Sign up screen");
},
child: Text(
"Sign up Bussiness",
style: TextStyle(
fontWeight: FontWeight.w900,
color: Colors.blue[900],
fontSize: _large ? 19 : (_medium ? 17 : 15)),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/signup.dart | //import 'dart:html';
// import 'dart:html';
import 'dart:io' as io;
import 'package:dsc/ui/customerdash.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dsc/constants/constants.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/customappbar.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:edge_alert/edge_alert.dart';
//import 'package:modal_progress_hud/modal_progress_hud.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:image_picker/image_picker.dart';
import 'package:firebase_core/firebase_core.dart' as firebase_core;
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
class SignUpScreen extends StatefulWidget {
SignUpScreen({Key key}) : super(key: key);
@override
_SignUpScreenState createState() => _SignUpScreenState();
}
/*class CustomTextField extends StatelessWidget {
final String hint;
final TextEditingController textEditingController;
final TextInputType keyboardType;
final bool obscureText;
final IconData icon;
double _width;
double _pixelRatio;
bool large;
bool medium;
CustomTextField({
this.hint,
this.textEditingController,
this.keyboardType,
this.icon,
this.obscureText = false,
void Function(String) onChanged,
});
@override
Widget build(BuildContext context) {
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
borderRadius: BorderRadius.circular(30.0),
elevation: large ? 12 : (medium ? 10 : 8),
child: TextFormField(
controller: textEditingController,
keyboardType: keyboardType,
cursorColor: Colors.orange[200],
decoration: InputDecoration(
prefixIcon: Icon(icon, color: Colors.orange[200], size: 20),
hintText: hint,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30.0),
borderSide: BorderSide.none),
),
),
);
}
}*/
enum UploadType {
/// Uploads a randomly generated string (as a file) to Storage.
string,
/// Uploads a file from the device.
file,
/// Clears any tasks from the list.
clear,
}
class _SignUpScreenState extends State<SignUpScreen> {
List<firebase_storage.UploadTask> _uploadTasks = [];
bool checkBoxValue = false;
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
bool signingup = false;
// var name, email, photoUrl, uid, emailVerified, phnum;
String _email, _password, name, phnum;
final auth = FirebaseAuth.instance;
final firestore = FirebaseFirestore.instance;
// TextEditingController name1 = new TextEditingController();
// //TextEditingController email = new TextEditingController();
// TextEditingController phnum1 = new TextEditingController();
Future<firebase_storage.UploadTask> uploadFile(PickedFile file) async {
if (file == null) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('No file was selected'),
));
return null;
}
firebase_storage.UploadTask uploadTask;
// Create a Reference to the file
firebase_storage.Reference ref = firebase_storage.FirebaseStorage.instance
.ref()
.child('User image')
.child('/user.jpg');
var url = await ref.getDownloadURL();
print(url);
// document.querySelector('img').src = test;
final metadata = firebase_storage.SettableMetadata(
contentType: 'image/jpeg',
customMetadata: {'picked-file-path': file.path});
if (kIsWeb) {
uploadTask = ref.putData(await file.readAsBytes(), metadata);
} else {
uploadTask = ref.putFile(io.File(file.path), metadata);
}
return Future.value(uploadTask);
}
/// Handles the user pressing the PopupMenuItem item.
/* Future<void> handleUploadType(UploadType type) async {
PickedFile file =
await ImagePicker().getImage(source: ImageSource.gallery);
firebase_storage.UploadTask task = await uploadFile(file);
if (task != null) {
setState(() {
_uploadTasks = [..._uploadTasks, task];
});
}
}*/ //////not in use right now
void _removeTaskAtIndex(int index) {
setState(() {
_uploadTasks = _uploadTasks..removeAt(index);
});
}
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Scaffold(
body: Container(
height: _height,
width: _width,
margin: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Opacity(opacity: 0.88, child: CustomAppBar()),
clipShape(),
form(),
acceptTermsTextRow(),
SizedBox(
height: _height / 35,
),
button(),
infoTextRow(),
//button1(),
socialIconsRow(),
//signInTextRow(),
],
),
),
),
),
);
}
Widget clipShape() {
return Stack(
children: <Widget>[
Opacity(
opacity: 0.75,
child: ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: _large
? _height / 8
: (_medium ? _height / 7 : _height / 6.5),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Opacity(
opacity: 0.5,
child: ClipPath(
clipper: CustomShapeClipper2(),
child: Container(
height: _large
? _height / 12
: (_medium ? _height / 11 : _height / 10),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Container(
height: _height / 5.5,
alignment: Alignment.center,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
spreadRadius: 0.0,
color: Colors.black26,
offset: Offset(1.0, 10.0),
blurRadius: 20.0),
],
color: Colors.white,
shape: BoxShape.circle,
),
child: GestureDetector(
onTap: () async {
PickedFile file =
await ImagePicker().getImage(source: ImageSource.gallery);
firebase_storage.UploadTask task = await uploadFile(file);
if (task != null) {
setState(() {
_uploadTasks = [..._uploadTasks, task];
});
}
print('Adding photo');
},
child: Icon(
Icons.add_a_photo,
size: _large ? 40 : (_medium ? 33 : 31),
color: Colors.blue[900],
)),
),
// Positioned(
// top: _height/8,
// left: _width/1.75,
// child: Container(
// alignment: Alignment.center,
// height: _height/23,
// padding: EdgeInsets.all(5),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Colors.orange[100],
// ),
// child: GestureDetector(
// onTap: (){
// print('Adding photo');
// },
// child: Icon(Icons.add_a_photo, size: _large? 22: (_medium? 15: 13),)),
// ),
// ),
],
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 20.0),
child: Form(
child: Column(
children: <Widget>[
firstNameTextFormField(),
SizedBox(height: _height / 60.0),
// lastNameTextFormField(),
// SizedBox(height: _height / 60.0),
emailTextFormField(),
SizedBox(height: _height / 60.0),
phoneTextFormField(),
SizedBox(height: _height / 60.0),
passwordTextFormField(),
],
),
),
);
}
Widget firstNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Full Name",
userTyped: (val) {
name = val;
},
// controller: name,
);
}
/* Widget lastNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'Last Name'),
onChanged: (value) {
setState(() {
_lname = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Last Name",
userTyped: (val) {
name = val;
});
}*/
Widget emailTextFormField() {
return /*TextField(
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(hintText: 'Email'),
onChanged: (value) {
setState(() {
_email = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.emailAddress,
icon: Icons.email,
hint: "Email ID",
userTyped: (val) {
_email = val;
}
//controller: email,
);
}
Widget phoneTextFormField() {
return /*TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(hintText: 'Phone Number'),
onChanged: (value) {
setState(() {
phnum = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.number,
icon: Icons.phone,
hint: "Mobile Number(OPTIONAL)",
userTyped: (val) {
phnum = val;
},
// controller: phnum,
);
}
Widget passwordTextFormField() {
return /*TextField(
obscureText: true,
decoration: InputDecoration(hintText: 'Password'),
onChanged: (value) {
setState(() {
_password = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
obscureText: true,
icon: Icons.lock,
hint: "Password",
userTyped: (val) {
_password = val;
});
}
Widget acceptTermsTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 100.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Checkbox(
activeColor: Colors.blue[400],
value: checkBoxValue,
onChanged: (bool newValue) {
setState(() {
checkBoxValue = newValue;
});
}),
Text(
"I accept all terms and conditions",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: _large ? 12 : (_medium ? 13 : 10)),
),
],
),
);
}
Widget infoTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 40.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Or create using social media",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: _large ? 12 : (_medium ? 11 : 10)),
),
],
),
);
}
Widget socialIconsRow() {
return Container(
margin: EdgeInsets.only(top: _height / 80.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
GestureDetector(
onTap: () async {
EdgeAlert.show(context,
title: 'Signup Failed',
description: 'WE ADDING THIS FEATURE SOON',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
// Navigator.of(context).pop(SIGN_IN);
// print("Routing to Sign up screen");
},
child: CircleAvatar(
radius: 15,
backgroundImage: AssetImage("assets/images/googlelogo.png"),
),
),
SizedBox(
width: 20,
),
GestureDetector(
onTap: () async {
EdgeAlert.show(context,
title: 'Signup Failed',
description: 'WE ADDING THIS FEATURE SOON',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
// Navigator.of(context).pop(SIGN_IN);
// print("Routing to Sign up screen");
},
child: CircleAvatar(
radius: 15,
backgroundImage: AssetImage("assets/images/fblogo.jpg"),
),
),
SizedBox(
width: 20,
),
GestureDetector(
onTap: () async {
EdgeAlert.show(context,
title: 'Signup Failed',
description: 'WE ADDING THIS FEATURE SOON',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
// Navigator.of(context).pop(SIGN_IN);
// print("Routing to Sign up screen");
},
child: CircleAvatar(
radius: 15,
backgroundImage: AssetImage("assets/images/twitterlogo.jpg"),
),
),
],
),
);
}
Widget signInTextRow() {
return Container(
margin: EdgeInsets.only(top: _height / 20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Already have an account?",
style: TextStyle(fontWeight: FontWeight.w400),
),
SizedBox(
width: 5,
),
GestureDetector(
onTap: () {
Navigator.of(context).pop(SIGN_IN);
print("Routing to Sign up screen");
},
child: Text(
"Sign in",
style: TextStyle(
fontWeight: FontWeight.w800,
color: Colors.blue[900],
fontSize: 19),
),
)
],
),
);
}
Widget button() {
return RaisedButton(
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (name != null &&
_password != null &&
_email != null &&
checkBoxValue == true) {
setState(() {
signingup = true;
});
try {
final newUser = await auth.createUserWithEmailAndPassword(
email: _email, password: _password);
// Map <String,dynamic> data= {"name":name.text,"email":email.text,"contact":phnum.text};
// FirebaseFirestore.instance.collection("users").doc("collection").set(data);
if (newUser != null) {
final User user = auth.currentUser;
final uid = user.uid;
/* firestore.collection("users").add({
"name": name,
"email": _email,
"contact": phnum,
"uid": uid
}).then((value) {
print(value.id);
print(uid);
});*/
firestore.collection("users").doc('$uid').set({
"name": name,
"email": _email,
"contact": phnum,
"uid": uid
});
// .doc("collection")
// .set(data);
// .collection("users")
// .doc("collection")
// .set(data);
User updateUser = FirebaseAuth.instance.currentUser;
updateUser.updateProfile(displayName: name);
// updateUser.updateProfile(photoURL: url);
// updateUser.uid;
// updateUser.displayName;
// updateUser.phoneNumber;
//await newUser.user.updateProfile(info);
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (BuildContext context) => Dashboard()),(Route<dynamic> route) => false);
}
} catch (e) {
setState(() {
signingup = false;
});
EdgeAlert.show(context,
title: 'Signup Failed',
description: e.toString(),
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
} else {
EdgeAlert.show(context,
title: 'Signup Failed',
description:
'All fields are required. Accept all terms and conditions',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
// height: _height / 20,
width: _large ? _width / 4 : (_medium ? _width / 2.75 : _width / 3.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'SIGN UP',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
),
);
}
// Widget button1() {
// return RaisedButton(
// elevation: 0,
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
// onPressed: () async {
// if (name != null &&
// _password != null &&
// _email != null &&
// checkBoxValue == true) {
// setState(() {
// signingup = true;
// });
// try {
// final newUser = await auth.createUserWithEmailAndPassword(
// email: _email, password: _password);
// // Map <String,dynamic> data= {"name":name.text,"email":email.text,"contact":phnum.text};
// // FirebaseFirestore.instance.collection("users").doc("collection").set(data);
// if (newUser != null) {
// final User user = auth.currentUser;
// final uid = user.uid;
// /* firestore.collection("users").add({
// "name": name,
// "email": _email,
// "contact": phnum,
// "uid": uid
// }).then((value) {
// print(value.id);
// print(uid);
// });*/
// firestore.collection("users").doc('$uid').set({
// "name": name,
// "email": _email,
// "contact": phnum,
// "uid": uid
// });
// // .doc("collection")
// // .set(data);
// // .collection("users")
// // .doc("collection")
// // .set(data);
// // User updateUser = FirebaseAuth.instance.currentUser;
// // updateUser.updateProfile(displayName: name);
// // updateUser.updateProfile(photoURL: url);
// // updateUser.uid;
// // updateUser.displayName;
// // updateUser.phoneNumber;
// //await newUser.user.updateProfile(info);
// Navigator.push(context,
// new MaterialPageRoute(builder: (context) => Dashboard()));
// }
// } catch (e) {
// setState(() {
// signingup = false;
// });
// EdgeAlert.show(context,
// title: 'Signup Failed',
// description: e.toString(),
// gravity: EdgeAlert.BOTTOM,
// icon: Icons.error,
// backgroundColor: Colors.blue[400]);
// }
// } else {
// EdgeAlert.show(context,
// title: 'Signup Failed',
// description:
// 'All fields are required. Accept all terms and conditions',
// gravity: EdgeAlert.BOTTOM,
// icon: Icons.error,
// backgroundColor: Colors.blue[400]);
// }
// },
// textColor: Colors.white,
// padding: EdgeInsets.all(0.0),
// child: Container(
// alignment: Alignment.center,
// // height: _height / 20,
// width: _large ? _width / 4 : (_medium ? _width / 2.75 : _width / 3.5),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(20.0)),
// gradient: LinearGradient(
// colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
// ),
// ),
// padding: const EdgeInsets.all(12.0),
// child: Text(
// 'SIGN UP Bussiness',
// style: TextStyle(
// fontWeight: FontWeight.w900,
// fontSize: _large ? 14 : (_medium ? 12 : 10)),
// ),
// ),
// );
// }
} //end of signup
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/dashboard.dart | import 'package:dsc/ui/contactus.dart';
import 'package:dsc/ui/jobdetails.dart';
import 'package:dsc/ui/jobhome.dart';
import 'package:dsc/ui/shops.dart';
import 'package:dsc/ui/signin.dart';
import 'package:dsc/ui/profile.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_image/firebase_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class AuthenticationProvider {
final FirebaseAuth firebaseAuth;
Widget dataname;
// FirebaseAuth instance
AuthenticationProvider(this.firebaseAuth);
//Constructor to initialize the Firebase Auth instance.
Stream<User> get authStateChanges => firebaseAuth.idTokenChanges();
Future<void> signOut() async {
await firebaseAuth.signOut();
}
}
class Dashboard extends StatefulWidget {
@override
_DashboardState createState() => _DashboardState();
}
class _DashboardState extends State<Dashboard> {
var user = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
final auth = FirebaseAuth.instance;
final User user = auth.currentUser;
final uid = user.uid;
Widget firedata() {
//BuildContext context
var firebaseUser = FirebaseAuth.instance.currentUser;
return new StreamBuilder(
stream: FirebaseFirestore.instance
.collection('users')
.doc(firebaseUser.uid)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return new Text("Loading");
}
var userDocument = snapshot.data;
return new Text(
userDocument["name"],
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontFamily: "Montserrat Regular",
fontWeight: FontWeight.bold,
),
);
});
}
return Scaffold(
backgroundColor: Colors.indigo[900],
body: SafeArea(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Container(
height: 64,
margin:
EdgeInsets.only(left: 20, top: 35, right: 20, bottom: 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
CircleAvatar(
radius: 32,
child: Image(
image: FirebaseImage(
'gs://job-co.appspot.com/user_image/$uid.jpg',
shouldCache:
true, // The image should be cached (default: True)
maxSizeBytes:
3000 * 1000, // 3MB max file size (default: 2.5MB)
cacheRefreshStrategy: CacheRefreshStrategy.NEVER,
),
// Works with standard parameters, e.g.
fit: BoxFit.cover,
width: 100,
height: 100,
// ... etc.
),
),
SizedBox(
width: 16,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
firedata(),
// Text(
// firedata(),
// style: TextStyle(
// fontFamily: "Montserrat Medium",
// color: Colors.white,
// fontSize: 20),
// ),
Text(
'${user.email}',
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: "Montserrat Regular"),
)
],
)
],
),
),
Align(
alignment: Alignment.bottomRight,
// ignore: deprecated_member_use
child: RaisedButton(
onPressed: () async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) => SignInPage()),
(Route<dynamic> route) => false);
},
child:
const Text('Signout', style: TextStyle(fontSize: 20)),
color: Colors.blueAccent,
textColor: Colors.white,
elevation: 5,
)),
Expanded(
child: GridView.count(
mainAxisSpacing: 10,
crossAxisSpacing: 10,
primary: false,
crossAxisCount: 2,
children: <Widget>[
Card(
elevation: 15,
margin: EdgeInsets.all(20),
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => HomePage()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/jobb.jpg',
height: 60,
),
Text('JOBS',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
)),
],
),
),
),
Card(
elevation: 15,
margin: EdgeInsets.all(20),
child: FlatButton(
onPressed: () {
padding:
EdgeInsets.all(100.0);
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => JobDetials()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/download.jpg',
height: 60,
),
Text('JOBS DETAILS',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
)),
],
),
),
),
Card(
elevation: 15,
margin: EdgeInsets.all(20),
child: FlatButton(
onPressed: () async {
var firebaseUser = FirebaseAuth.instance.currentUser;
// ignore: unused_local_variable
DocumentSnapshot value = await FirebaseFirestore
.instance
.collection("users")
.doc(firebaseUser.uid)
.get()
.then((value) {
// return value.data();
print(value.data());
// Text:value.data();
}); //ye kyu kiya hai teju?
Navigator.push(
context,
new MaterialPageRoute(
builder: (BuildContext context) =>
Profile()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/profo.jpg',
height: 60,
),
Text('PROFILE',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
)),
],
),
),
),
Card(
elevation: 15,
margin: EdgeInsets.all(20),
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Shop1()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/application.jpg',
height: 60,
),
Text('SHOPS',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
)),
],
),
),
),
Card(
elevation: 15,
margin: EdgeInsets.all(20),
child: FlatButton(
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => Contact()));
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/contact.png',
height: 50,
),
Text('CONTACT US',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 12,
)),
],
),
),
),
],
),
),
],
),
),
),
);
// ignore: dead_code
}
} | 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/contactus.dart | import 'package:contactus/contactus.dart';
import 'package:flutter/material.dart';
class Contact extends StatefulWidget {
@override
_ContactusState createState() => _ContactusState();
}
class _ContactusState extends State<Contact> {
@override
Widget build(BuildContext context) {
return Scaffold(
// bottomNavigationBar: ContactUsBottomAppBar(
// companyName: 'DSC-SOLUTION',
// textColor: Colors.white,
// backgroundColor: Colors.teal.shade300,
// email: 'adoshi26.ad@gmail.com',
// ),
backgroundColor: Colors.teal[100],
body: SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20, top:35, right: 20, bottom:0),
),
Text(
"About Us",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 50,
color: Colors.grey[600],
// fontSize: _large ? 60 : (_medium ? 50 : 40),
),
),
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 15.0, horizontal: 30.0),
child: ContactUs(
// borderRadius: BorderRadius.circular(8),
cardColor: Colors.grey[300],
textColor: Colors.black,
logo: AssetImage('assets/images/logo.jpeg'),
email: 'dscflutter@gmail.com',
companyName: 'Satish Chauhan',
companyColor: Colors.black54,
phoneNumber: '+917818XXXXX',
// website: 'https://abhishekdoshi.godaddysites.com',
// githubUserName: 'AbhishekDoshi26',
linkedinURL: 'https://www.linkedin.com/in/satish603/',
tagLine: 'Flutter Developer',
taglineColor: Colors.black38,
// twitterHandle: 'AbhishekDoshi26',
instagram: 'satish_603',
// facebookHandle: '_abhishek_doshi'
),
),
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 50.0, horizontal: 25.0),
child: ContactUs(
cardColor: Colors.grey[300],
textColor: Colors.black,
logo: AssetImage('assets/images/logo.jpeg'),
email: 'dscflutter@gmail.com',
companyName: 'Tejashri Mitbavkar',
companyColor: Colors.black54,
phoneNumber: '+917818XXXXX',
// website: 'https://abhishekdoshi.godaddysites.com',
// githubUserName: 'AbhishekDoshi26',
linkedinURL:
'https://www.linkedin.com/in/tejashri-mitbavkar-bb3871192',
tagLine: 'Flutter Developer',
taglineColor: Colors.black38,
// twitterHandle: 'AbhishekDoshi26',
instagram: 'teju.s.m',
// facebookHandle: '_abhishek_doshi'
),
),
Card(
color: Colors.white,
margin: EdgeInsets.symmetric(vertical: 50.0, horizontal: 25.0),
child: ContactUs(
cardColor: Colors.grey[300],
textColor: Colors.black,
logo: AssetImage('assets/images/logo.jpeg'),
email: 'dscflutter@gmail.com',
companyName: 'Arijit Bera',
companyColor: Colors.black54,
phoneNumber: '+917818XXXXX',
// website: 'https://abhishekdoshi.godaddysites.com',
// githubUserName: 'AbhishekDoshi26',
linkedinURL:
'https://www.linkedin.com/in/arijit-bera-792006157',
tagLine: 'Flutter Developer',
taglineColor: Colors.black38,
// twitterHandle: 'AbhishekDoshi26',
instagram: 'bera_213_',
// facebookHandle: '_abhishek_doshi'
),
),
],
),
),
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib | mirrored_repositories/JOB-CO/lib/ui/Update_Profile.dart | import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dsc/ui/dashboard.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:dsc/ui/widgets/custom_shape.dart';
import 'package:dsc/ui/widgets/customappbar.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
import 'package:edge_alert/edge_alert.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dsc/ui/widgets/textformfield.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart' as Path;
import 'dart:io' as io;
import 'package:firebase_storage/firebase_storage.dart' as firebase_storage;
class UProfile extends StatefulWidget {
UProfile({Key key}) : super(key: key);
@override
_UProfileState createState() => _UProfileState();
}
class _UProfileState extends State<UProfile> {
List<firebase_storage.UploadTask> _uploadTasks = [];
bool checkBoxValue = false;
double _height;
double _width;
double _pixelRatio;
bool _large;
bool _medium;
bool signingup = false;
// var name, email, photoUrl, uid, emailVerified, phnum;
String _email, _password, name, phnum;
final auth = FirebaseAuth.instance;
final firestore = FirebaseFirestore.instance;
Future<firebase_storage.UploadTask> uploadFile(PickedFile file) async {
if (file == null) {
EdgeAlert.show(context,
title: 'No file was selected',
description: "Please select image to upload",
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
return null;
}
firebase_storage.UploadTask uploadTask;
final User user = auth.currentUser;
final uid = user.uid;
// Create a Reference to the file
firebase_storage.Reference ref = firebase_storage.FirebaseStorage.instance
.ref()
.child('User_image')
.child('/$uid.jpg');
final metadata = firebase_storage.SettableMetadata(
contentType: 'image/jpeg',
customMetadata: {'picked-file-path': file.path});
if (kIsWeb) {
uploadTask = ref.putData(await file.readAsBytes(), metadata);
} else {
uploadTask = ref.putFile(io.File(file.path), metadata);
}
return Future.value(uploadTask);
}
void _removeTaskAtIndex(int index) {
setState(() {
_uploadTasks = _uploadTasks..removeAt(index);
});
}
@override
Widget build(BuildContext context) {
_height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
_large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
_medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
child: Scaffold(
body: Container(
height: _height,
width: _width,
margin: EdgeInsets.only(bottom: 5),
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Opacity(opacity: 0.88, child: CustomAppBar()),
clipShape(),
form(),
SizedBox(
height: _height / 35,
),
button(),
],
),
),
),
),
);
}
Widget clipShape() {
return Stack(
children: <Widget>[
Opacity(
opacity: 0.75,
child: ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: _large
? _height / 8
: (_medium ? _height / 7 : _height / 6.5),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Opacity(
opacity: 0.5,
child: ClipPath(
clipper: CustomShapeClipper2(),
child: Container(
height: _large
? _height / 12
: (_medium ? _height / 11 : _height / 10),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue[200], Colors.yellowAccent],
),
),
),
),
),
Container(
height: _height / 5.5,
alignment: Alignment.center,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
spreadRadius: 0.0,
color: Colors.black26,
offset: Offset(1.0, 10.0),
blurRadius: 20.0),
],
color: Colors.white,
shape: BoxShape.circle,
),
child: GestureDetector(
onTap: () async {
PickedFile file =
await ImagePicker().getImage(source: ImageSource.gallery);
firebase_storage.UploadTask task = await uploadFile(file);
if (task != null) {
setState(() {
_uploadTasks = [..._uploadTasks, task];
});
}
print('Adding photo');
},
child: Icon(
Icons.add_a_photo,
size: _large ? 40 : (_medium ? 33 : 31),
color: Colors.blue[900],
)),
),
],
);
}
Widget form() {
return Container(
margin: EdgeInsets.only(
left: _width / 12.0, right: _width / 12.0, top: _height / 20.0),
child: Form(
child: Column(
children: <Widget>[
firstNameTextFormField(),
SizedBox(height: _height / 60.0),
// lastNameTextFormField(),
// SizedBox(height: _height / 60.0),
emailTextFormField(),
SizedBox(height: _height / 60.0),
phoneTextFormField(),
SizedBox(height: _height / 60.0),
passwordTextFormField(),
],
),
),
);
}
Widget firstNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'First Name'),
onChanged: (value) {
setState(() {
name = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Full Name",
userTyped: (val) {
name = val;
},
// controller: name,
);
}
/* Widget lastNameTextFormField() {
return /*TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(hintText: 'Last Name'),
onChanged: (value) {
setState(() {
_lname = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
icon: Icons.person,
hint: "Last Name",
userTyped: (val) {
name = val;
});
}*/
Widget emailTextFormField() {
return /*TextField(
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(hintText: 'Email'),
onChanged: (value) {
setState(() {
_email = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.emailAddress,
icon: Icons.email,
hint: "Email ID",
userTyped: (val) {
_email = val;
}
//controller: email,
);
}
Widget phoneTextFormField() {
return /*TextField(
keyboardType: TextInputType.number,
decoration: InputDecoration(hintText: 'Phone Number'),
onChanged: (value) {
setState(() {
phnum = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.number,
icon: Icons.phone,
hint: "Mobile Number(OPTIONAL)",
userTyped: (val) {
phnum = val;
},
// controller: phnum,
);
}
Widget passwordTextFormField() {
return /*TextField(
obscureText: true,
decoration: InputDecoration(hintText: 'Password'),
onChanged: (value) {
setState(() {
_password = value.trim();
});
},
);*/
CustomTextField(
keyboardType: TextInputType.text,
obscureText: true,
icon: Icons.lock,
hint: "Password",
userTyped: (val) {
_password = val;
});
}
// Widget acceptTermsTextRow() {
// return Container(
// margin: EdgeInsets.only(top: _height / 100.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Checkbox(
// activeColor: Colors.blue[400],
// value: checkBoxValue,
// onChanged: (bool newValue) {
// setState(() {
// checkBoxValue = newValue;
// });
// }),
// Text(
// "I accept all terms and conditions",
// style: TextStyle(
// fontWeight: FontWeight.w600,
// fontSize: _large ? 12 : (_medium ? 13 : 10)),
// ),
// ],
// ),
// );
// }
// Widget infoTextRow() {
// return Container(
// margin: EdgeInsets.only(top: _height / 40.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Text(
// "Or create using social media",
// style: TextStyle(
// fontWeight: FontWeight.w500,
// fontSize: _large ? 12 : (_medium ? 11 : 10)),
// ),
// ],
// ),
// );
// }
Widget button() {
return RaisedButton(
elevation: 0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30.0)),
onPressed: () async {
if (name != null) {
setState(() {
signingup = true;
});
try {
// final newUser =
// await auth.createUserWithEmailAndPassword(email: _email);
// password: _password);
// Map <String,dynamic> data= {"name":name.text,"email":email.text,"contact":phnum.text};
// FirebaseFirestore.instance.collection("users").doc("collection").set(data);
// if (newUser != null) {
final User user = auth.currentUser;
final uid = user.uid;
/* firestore.collection("users").add({
"name": name,
"email": _email,
"contact": phnum,
"uid": uid
}).then((value) {
print(value.id);
print(uid);
});*/
firestore.collection("users").doc('$uid').set({
"name": name,
// "email": _email,
"contact": phnum,
"uid": uid,
"photo": "gs://dscsolution-80cbc.appspot.com/User_image/$uid.jpg"
}, SetOptions(merge: true));
// .doc("collection")
// .set(data);
// .collection("users")
// .doc("collection")
// .set(data);
// User updateUser = FirebaseAuth.instance.currentUser;
// updateUser.updateProfile(displayName: name);
// updateUser.updateProfile(photoURL: url);
// updateUser.uid;
// updateUser.displayName;
// updateUser.phoneNumber;
// await newUser.user.updateProfile(info);
Navigator.push(context,
new MaterialPageRoute(builder: (context) => Dashboard()));
// }
} catch (e) {
EdgeAlert.show(context,
title: 'Update Failed',
description: 'All fields are required. ',
gravity: EdgeAlert.BOTTOM,
icon: Icons.error,
backgroundColor: Colors.blue[400]);
}
}
},
textColor: Colors.white,
padding: EdgeInsets.all(0.0),
child: Container(
alignment: Alignment.center,
// height: _height / 20,
width: _large ? _width / 4 : (_medium ? _width / 2.75 : _width / 3.5),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.0)),
gradient: LinearGradient(
colors: <Color>[Colors.blue[900], Colors.blueAccent[100]],
),
),
padding: const EdgeInsets.all(12.0),
child: Text(
'UPDATE PROFILE',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: _large ? 14 : (_medium ? 12 : 10)),
),
),
);
}
} //end of signup
| 0 |
mirrored_repositories/JOB-CO/lib/ui | mirrored_repositories/JOB-CO/lib/ui/widgets/textformfield.dart | import 'package:flutter/material.dart';
import 'package:dsc/ui/widgets/responsive_ui.dart';
class CustomTextField extends StatelessWidget {
final String hint;
final TextEditingController textEditingController;
final TextInputType keyboardType;
final bool obscureText;
final IconData icon;
double _width;
double _pixelRatio;
bool large;
bool medium;
final Function userTyped;
//CustomTextInput({this.hintText, this.leading,this.userTyped,this.obscure,this.keyboard=TextInputType.text});
CustomTextField({
this.hint,
this.userTyped,
this.textEditingController,
this.keyboardType,
this.icon,
this.obscureText = false,
TextEditingController controller,
InputDecoration decoration,
void Function(String) onChanged,
Color color,
// Null Function(Null) onChanged,
});
@override
Widget build(BuildContext context) {
_width = MediaQuery.of(context).size.width;
_pixelRatio = MediaQuery.of(context).devicePixelRatio;
large = ResponsiveWidget.isScreenLarge(_width, _pixelRatio);
medium = ResponsiveWidget.isScreenMedium(_width, _pixelRatio);
return Material(
borderRadius: BorderRadius.circular(30.0),
elevation: large ? 12 : (medium ? 10 : 8),
child: TextField(
obscureText: obscureText,
onChanged: userTyped,
onSubmitted: (value) {},
controller: textEditingController,
keyboardType: keyboardType,
cursorColor: Colors.blue[800],
decoration: InputDecoration(
prefixIcon: Icon(icon, color: Colors.blue[900], size: 20),
hintText: hint,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30.0),
borderSide: BorderSide.none),
),
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib/ui | mirrored_repositories/JOB-CO/lib/ui/widgets/custom_shape.dart | import 'package:flutter/material.dart';
class CustomShapeClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final Path path = Path();
path.lineTo(0.0, size.height-70);
var firstEndPoint = Offset(size.width * .5, size.height - 30.0);
var firstControlpoint = Offset(size.width * 0.25, size.height - 50.0);
path.quadraticBezierTo(firstControlpoint.dx, firstControlpoint.dy, firstEndPoint.dx, firstEndPoint.dy);
var secondEndPoint = Offset(size.width, size.height - 50.0);
var secondControlPoint = Offset(size.width * .75, size.height - 10);
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, secondEndPoint.dx, secondEndPoint.dy);
path.lineTo(size.width, 0.0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper oldClipper) => true;
}
class CustomShapeClipper2 extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final Path path = Path();
path.lineTo(0.0, size.height - 20);
var firstEndPoint = Offset(size.width * .5, size.height - 30.0);
var firstControlpoint = Offset(size.width * 0.25, size.height - 50.0);
path.quadraticBezierTo(
firstControlpoint.dx, firstControlpoint.dy, firstEndPoint.dx,
firstEndPoint.dy);
var secondEndPoint = Offset(size.width, size.height-5);
var secondControlPoint = Offset(size.width * .75, size.height - 20);
path.quadraticBezierTo(
secondControlPoint.dx, secondControlPoint.dy, secondEndPoint.dx,
secondEndPoint.dy);
path.lineTo(size.width, 0.0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper oldClipper) => true;
} | 0 |
mirrored_repositories/JOB-CO/lib/ui | mirrored_repositories/JOB-CO/lib/ui/widgets/customappbar.dart | import 'package:flutter/material.dart';
class CustomAppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
return Material(
child: Container(
height: height/10,
width: width,
padding: EdgeInsets.only(left: 15, top: 25),
decoration: BoxDecoration(
gradient: LinearGradient(
colors:[Colors.blue[200], Colors.yellowAccent]
),
),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(Icons.arrow_back,),
onPressed: (){
print("pop");
Navigator.of(context).pop();
})
],
),
),
);
}
}
| 0 |
mirrored_repositories/JOB-CO/lib/ui | mirrored_repositories/JOB-CO/lib/ui/widgets/responsive_ui.dart |
class ResponsiveWidget{
static bool isScreenLarge(double width, double pixel) {
return width * pixel >= 1440;
}
static bool isScreenMedium(double width, double pixel) {
return width * pixel < 1440 && width * pixel >=1080;
}
static bool isScreenSmall(double width, double pixel) {
return width * pixel <= 720;
}
} | 0 |
mirrored_repositories/JOB-CO | mirrored_repositories/JOB-CO/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:dsc/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/AFE_flutter | mirrored_repositories/AFE_flutter/lib/main.dart | import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'AFE Flutter',
debugShowCheckedModeBanner: false,
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or press Run > Flutter Hot Reload in a Flutter IDE). Notice that the
// counter didn't reset back to zero; the application is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'AFE Flutter Module'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String dropdownValue = 'Add';
int _result = 0;
int _first = 0;
int _second = 0;
String resultStr = "";
static const platform = const MethodChannel('in.androidgeek.afe/data');
_MyHomePageState() {
platform.setMethodCallHandler(_receiveFromHost);
}
Future<void> _receiveFromHost(MethodCall call) async {
int f = 0;
int s = 0;
try {
print(call.method);
if (call.method == "fromHostToClient") {
final String data = call.arguments;
print(call.arguments);
final jData = jsonDecode(data);
f = jData['first'];
s = jData['second'];
}
} on PlatformException catch (e) {
//platform may not able to send proper data.
}
setState(() {
_first = f;
_second = s;
});
}
_addNumbers(int n1, int n2) {
return n1 + n2;
}
_multiplyNumbers(int n1, int n2) {
return n1 * n2;
}
_setResults(int n1, int n2) {
setState(() {
if (dropdownValue == 'Add') {
_result = _addNumbers(n1, n2);
} else {
_result = _multiplyNumbers(n1, n2);
}
});
}
void _sendResultsToAndroidiOS() {
if (dropdownValue == 'Add') {
_result = _addNumbers(_first, _second);
} else {
_result = _multiplyNumbers(_first, _second);
}
Map<String, dynamic> resultMap = Map();
resultMap['operation'] = dropdownValue;
resultMap['result'] = _result;
setState(() {
resultStr = resultMap.toString();
});
platform.invokeMethod("FromClientToHost", resultMap);
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('First Number: ',
style:
TextStyle(color: Colors.black, fontSize: 16)),
Text(_first.toString(),
style: TextStyle(color: Colors.blue, fontSize: 16)),
])),
Container(
padding: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Second Number: ',
style:
TextStyle(color: Colors.black, fontSize: 16)),
Text(_second.toString(),
style: TextStyle(color: Colors.blue, fontSize: 16)),
])),
Container(
margin: EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DropdownButton<String>(
value: dropdownValue,
style: TextStyle(color: Colors.blue, fontSize: 16),
items: <String>['Add', 'Multiply']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
)
],
)),
RaisedButton(
onPressed: () {
_sendResultsToAndroidiOS();
},
textColor: Colors.white,
padding: const EdgeInsets.all(0.0),
child: Container(
decoration: BoxDecoration(color: Colors.blue),
padding: const EdgeInsets.all(10.0),
child: const Text('Send Results to Android/iOS module',
style: TextStyle(fontSize: 16))),
)
],
),
));
}
}
| 0 |
mirrored_repositories/AFE_flutter | mirrored_repositories/AFE_flutter/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:afe_flutter/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/Flutter-To-Do-App-V1 | mirrored_repositories/Flutter-To-Do-App-V1/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simple_to_do_app/screens/home.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}):super(key:key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent));
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ToDo App',
home: Home(),
);
}
}
| 0 |
mirrored_repositories/Flutter-To-Do-App-V1/lib | mirrored_repositories/Flutter-To-Do-App-V1/lib/constants/colors.dart | import 'package:flutter/material.dart';
const Color tdRed=Color(0xFFDA4040);
const Color tdBlue=Color(0xFF5f52EE);
const Color tdBlack=Color(0xFF3A3A3A);
const Color tdGrey=Color(0xFF717171);
const Color tdBGColor=Color(0xFFEEEFF5);
| 0 |
mirrored_repositories/Flutter-To-Do-App-V1/lib | mirrored_repositories/Flutter-To-Do-App-V1/lib/widgets/todo_item.dart | import 'package:flutter/material.dart';
import '../constants/colors.dart';
import '../model/todo.dart';
class ToDoItem extends StatelessWidget {
final ToDo todo;
final onToDoChanged;
final onDeleteItem;
const ToDoItem({Key?key,required this.todo,required this.onToDoChanged, required this.onDeleteItem,}):super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 20),
child: ListTile(onTap: (){
//print("Clicked on ToDo Item");
onToDoChanged(todo);
},
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)
),
contentPadding: EdgeInsets.symmetric(horizontal: 20,vertical: 5),
tileColor: Colors.white,
leading: Icon(
todo.isDone? Icons.check_box:Icons.check_box_outline_blank,
color: tdBlue,),
title: Text(
todo.todoText!,
style: TextStyle(
fontSize: 16,
color: tdBlack,
decoration: todo.isDone? TextDecoration.lineThrough:null,
),
),
trailing: Container(
padding: EdgeInsets.all(0),
margin: EdgeInsets.symmetric(vertical: 12),
height: 35,
width: 35,
decoration: BoxDecoration(
color: tdRed,
borderRadius: BorderRadius.circular(5)
),
child: IconButton(
color: Colors.white,
iconSize: 18,
icon:Icon(Icons.delete),
onPressed: (){
//print("Clicked on Delete Button");
onDeleteItem(todo.id);
},
),
),
),
);
}
} | 0 |
mirrored_repositories/Flutter-To-Do-App-V1/lib | mirrored_repositories/Flutter-To-Do-App-V1/lib/model/todo.dart | class ToDo{
String?id;
String?todoText;
bool isDone;
ToDo({
required this.id,
required this.todoText,
this.isDone=false
});
static List<ToDo> toDoList(){
return[
ToDo(id: '01', todoText: 'Morning Exercise',isDone: true),
ToDo(id: '02', todoText: 'Morning E',isDone: true),
ToDo(id: '03', todoText: 'Morning Exercise',),
ToDo(id: '04', todoText: 'Morning Exercise',isDone: true),
ToDo(id: '05', todoText: 'Morning Exercise',isDone: true),
];
}
} | 0 |
mirrored_repositories/Flutter-To-Do-App-V1/lib | mirrored_repositories/Flutter-To-Do-App-V1/lib/screens/home.dart | import 'package:flutter/material.dart';
import '../constants/colors.dart';
import '../widgets/todo_item.dart';
import '../model/todo.dart';
class Home extends StatefulWidget{
Home({Key?key}):super(key: key);
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
final todosList = ToDo.toDoList();
List<ToDo> _foundToDo=[];
final _todoController=TextEditingController();
@override
void initState() {
_foundToDo=todosList;
super.initState();
}
@override
Widget build(BuildContext context){
return Scaffold(
backgroundColor: tdBGColor,
appBar: _buildAppBar(),
body: Stack(
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: 20,
vertical: 15
),
child: Column(children: [
searchBox(),
Expanded(
child: ListView(
children: [
Container(
margin: EdgeInsets.only(
top: 50,
bottom: 20,
),
child: Text(
'All ToDos',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.w500,
),
),
),
for(ToDo todo in _foundToDo.reversed)
ToDoItem(
todo: todo,
onToDoChanged: _handleToDoChange,
onDeleteItem: _deleteToDoItem,
),
],
),
)
]
),
),
Align(
alignment: Alignment.bottomCenter,
child: Row(children: [
Expanded(child: Container(margin: EdgeInsets.only(
bottom:20,
right: 20,
left: 20 ),
padding: EdgeInsets.symmetric(
horizontal: 20,
vertical: 5
),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [BoxShadow(
color: Colors.grey,
offset: Offset(0.0,0.0),
blurRadius: 10.0,
spreadRadius: 0.0,
),],
borderRadius: BorderRadius.circular(10),
),
child: TextField(
controller: _todoController,
decoration: InputDecoration(
hintText: 'Add a new todo item',
border: InputBorder.none
),
),
),
),
Container(
margin: EdgeInsets.only(
bottom: 20,
right: 20,
),
child: ElevatedButton(
child: Text('+',style: TextStyle(fontSize: 40),),
onPressed: (){
_addToDoItem(_todoController.text);
},
style: ElevatedButton.styleFrom(
primary: tdBlue,
minimumSize: Size(60, 60),
elevation: 10,
),
),
)
]),
),
],
),
);
}
void _handleToDoChange(ToDo todo){
setState(() {
todo.isDone=!todo.isDone;
});
}
void _deleteToDoItem(String id){
setState(() {
todosList.removeWhere((item) => item.id==id);
});
}
void _addToDoItem(String toDo){
setState(() {
todosList.add(ToDo(
id: DateTime.now().millisecondsSinceEpoch.toString(),
todoText: toDo,
));
});
_todoController.clear();
}
void _runFilter(String enteredKeyword){
List<ToDo> results=[];
if(enteredKeyword.isEmpty){
results=todosList;
}
else{
results=todosList
.where((item) => item.todoText!
.toLowerCase()
.contains(enteredKeyword.toLowerCase()))
.toList();
}
setState(() {
_foundToDo=results;
});
}
Widget searchBox(){
return Container(
padding: EdgeInsets.symmetric(horizontal: 15),
decoration:BoxDecoration(
color:Colors.white,
borderRadius:BorderRadius.circular(20)
) ,
child: TextField(
onChanged: (value) => _runFilter(value),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
prefixIcon: Icon(
Icons.search,
color: tdBlack,
size:20,
),
prefixIconConstraints: BoxConstraints(
maxHeight: 20,
minWidth: 25
),
border: InputBorder.none,
hintText: 'Search',
hintStyle: TextStyle(color: tdGrey),
),
),
);
}
AppBar _buildAppBar() {
return AppBar(
elevation: 0,
backgroundColor: tdBGColor,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(Icons.menu,
color: tdBlack,
size: 30,),
Container(
height: 40,
width: 40,
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.asset('assets/images/avatar.jpg'),
),
)
]),
);
}
} | 0 |
mirrored_repositories/Flutter-To-Do-App-V1 | mirrored_repositories/Flutter-To-Do-App-V1/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:simple_to_do_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/datena-notebook/datenaFrontEnd/mobile/datena | mirrored_repositories/datena-notebook/datenaFrontEnd/mobile/datena/lib/main.dart | import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
| 0 |
mirrored_repositories/datena-notebook/datenaFrontEnd/mobile/datena | mirrored_repositories/datena-notebook/datenaFrontEnd/mobile/datena/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:datena/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/flutter-studies/meme-generation | mirrored_repositories/flutter-studies/meme-generation/lib/main.dart | import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'controllers/file.controller.dart';
import 'views/home/home.view.dart';
void main() {
GetIt provider = GetIt.instance;
provider.registerSingleton<FileController>(FileController());
provider.registerSingleton<Random>(Random());
return runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Meme Generation',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomeView(),
);
}
}
| 0 |
mirrored_repositories/flutter-studies/meme-generation/lib/views | mirrored_repositories/flutter-studies/meme-generation/lib/views/home/home.view.dart | import 'package:meme_generation/controllers/file.controller.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:path_provider/path_provider.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_it/get_it.dart';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'dart:math';
import 'dart:io';
class HomeView extends StatefulWidget {
@override
_HomeViewState createState() => _HomeViewState();
}
class _HomeViewState extends State<HomeView> {
final GlobalKey _globalKey = new GlobalKey();
FileController _fileController;
Random _rng;
@override
void initState() {
super.initState();
_fileController = GetIt.instance<FileController>();
_rng = GetIt.instance<Random>();
}
@override
Widget build(BuildContext context) {
double _layoutWidth = MediaQuery.of(context).size.width;
double _statusHeight = MediaQuery.of(context).padding.top;
return Scaffold(
body: SingleChildScrollView(
child: Container(
child: Column(
children: <Widget>[
Container(
height: _statusHeight,
),
Image.asset('assets/images/smiller.png', height: 50),
Image.asset('assets/images/meme-generator.png', height: 60,),
SizedBox(height: 5),
RepaintBoundary(
key: _globalKey,
child: Stack(
children: <Widget>[
Observer(
builder: (BuildContext context) {
return _fileController.image != null ? Image.file(
_fileController.image,
height: 250,
width: _layoutWidth,
fit: BoxFit.fitHeight,
) : Container();
},
),
Container(
height: 250,
width: _layoutWidth,
child: Observer(
builder: (context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Text(
_fileController.headerText.toUpperCase(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 26
),),
),
Spacer(),
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Text(
_fileController.footerText.toUpperCase(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 26
),),
)
],
);
}
),
)
]
),
),
SizedBox(height: 5),
Observer(
builder: (context) {
return _fileController.imageSelected ? Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: <Widget>[
TextField(
onChanged: (value) {
_fileController.setHeaderText(text: value);
},
decoration: InputDecoration(
hintText: "Header Text"
)
),
SizedBox(height: 12),
TextField(
onChanged: (value) {
_fileController.setFooterText(text: value);
},
decoration: InputDecoration(
hintText: "Footer Text"
)
),
Observer(
builder: (context) {
return RaisedButton(
onPressed: () {
_takeScreenshot();
},
child: Text("Save")
);
}
)
],
),
) : Container(
child: Center(
child: Text("Select image to get started")
),
);
}
),
Observer(
builder: (context) {
return _fileController.imageFile != null ? Image.file(_fileController.imageFile) : Container();
}
)
],
)
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
_fileController.getImage();
},
child: Icon(Icons.add_a_photo)
),
);
}
void _takeScreenshot() async {
RenderRepaintBoundary boundary = _globalKey.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();
final directory = (await getApplicationDocumentsDirectory()).path;
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();
File imgFile = new File('$directory/screenshot${_rng.nextInt(200)}.png');
_fileController.setImageFile(img: imgFile);
_saveFile(file: imgFile);
imgFile.writeAsBytes(pngBytes);
}
_saveFile({File file}) async {
await _askPermission();
final result = await ImageGallerySaver.saveImage(Uint8List.fromList(await file.readAsBytes()));
}
_askPermission() async {
Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.photos]);
}
} | 0 |
mirrored_repositories/flutter-studies/meme-generation/lib | mirrored_repositories/flutter-studies/meme-generation/lib/controllers/file.controller.dart | import 'package:image_picker/image_picker.dart';
import 'package:mobx/mobx.dart';
import 'dart:io';
part 'file.controller.g.dart';
class FileController = _FileControllerBase with _$FileController;
abstract class _FileControllerBase with Store {
@observable
String _headerText = "";
@observable
String _footerText = "";
@observable
File _image = null;
@observable
File _imageFile = null;
@observable
bool _imageSelected = false;
@computed
String get headerText => _headerText;
@computed
String get footerText => _footerText;
@computed
File get imageFile => _imageFile;
@computed
File get image => _image;
@computed
bool get imageSelected => _imageSelected;
@action
void setImageFile({File img}) {
_imageFile = img;
}
@action
void setHeaderText({String text}) {
_headerText = text;
}
@action
void setFooterText({String text}) {
_footerText = text;
}
@action
Future getImage() async {
var image;
try {
image = await ImagePicker.pickImage(source: ImageSource.gallery);
} catch(error) {
print("Error load image: ${error}");
}
if (image != null) {
_imageSelected = true;
}
_image = image;
var path = new Directory('storage/emulated/0/' + 'MemeGenerator').create(recursive: true);
print("TESTS: $path");
}
} | 0 |
mirrored_repositories/flutter-studies/meme-generation/lib | mirrored_repositories/flutter-studies/meme-generation/lib/controllers/file.controller.g.dart | // GENERATED CODE - DO NOT MODIFY BY HAND
part of 'file.controller.dart';
// **************************************************************************
// StoreGenerator
// **************************************************************************
// ignore_for_file: non_constant_identifier_names, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic
mixin _$FileController on _FileControllerBase, Store {
Computed<String> _$headerTextComputed;
@override
String get headerText =>
(_$headerTextComputed ??= Computed<String>(() => super.headerText)).value;
Computed<String> _$footerTextComputed;
@override
String get footerText =>
(_$footerTextComputed ??= Computed<String>(() => super.footerText)).value;
Computed<File> _$imageFileComputed;
@override
File get imageFile =>
(_$imageFileComputed ??= Computed<File>(() => super.imageFile)).value;
Computed<File> _$imageComputed;
@override
File get image =>
(_$imageComputed ??= Computed<File>(() => super.image)).value;
Computed<bool> _$imageSelectedComputed;
@override
bool get imageSelected =>
(_$imageSelectedComputed ??= Computed<bool>(() => super.imageSelected))
.value;
final _$_headerTextAtom = Atom(name: '_FileControllerBase._headerText');
@override
String get _headerText {
_$_headerTextAtom.context.enforceReadPolicy(_$_headerTextAtom);
_$_headerTextAtom.reportObserved();
return super._headerText;
}
@override
set _headerText(String value) {
_$_headerTextAtom.context.conditionallyRunInAction(() {
super._headerText = value;
_$_headerTextAtom.reportChanged();
}, _$_headerTextAtom, name: '${_$_headerTextAtom.name}_set');
}
final _$_footerTextAtom = Atom(name: '_FileControllerBase._footerText');
@override
String get _footerText {
_$_footerTextAtom.context.enforceReadPolicy(_$_footerTextAtom);
_$_footerTextAtom.reportObserved();
return super._footerText;
}
@override
set _footerText(String value) {
_$_footerTextAtom.context.conditionallyRunInAction(() {
super._footerText = value;
_$_footerTextAtom.reportChanged();
}, _$_footerTextAtom, name: '${_$_footerTextAtom.name}_set');
}
final _$_imageAtom = Atom(name: '_FileControllerBase._image');
@override
File get _image {
_$_imageAtom.context.enforceReadPolicy(_$_imageAtom);
_$_imageAtom.reportObserved();
return super._image;
}
@override
set _image(File value) {
_$_imageAtom.context.conditionallyRunInAction(() {
super._image = value;
_$_imageAtom.reportChanged();
}, _$_imageAtom, name: '${_$_imageAtom.name}_set');
}
final _$_imageFileAtom = Atom(name: '_FileControllerBase._imageFile');
@override
File get _imageFile {
_$_imageFileAtom.context.enforceReadPolicy(_$_imageFileAtom);
_$_imageFileAtom.reportObserved();
return super._imageFile;
}
@override
set _imageFile(File value) {
_$_imageFileAtom.context.conditionallyRunInAction(() {
super._imageFile = value;
_$_imageFileAtom.reportChanged();
}, _$_imageFileAtom, name: '${_$_imageFileAtom.name}_set');
}
final _$_imageSelectedAtom = Atom(name: '_FileControllerBase._imageSelected');
@override
bool get _imageSelected {
_$_imageSelectedAtom.context.enforceReadPolicy(_$_imageSelectedAtom);
_$_imageSelectedAtom.reportObserved();
return super._imageSelected;
}
@override
set _imageSelected(bool value) {
_$_imageSelectedAtom.context.conditionallyRunInAction(() {
super._imageSelected = value;
_$_imageSelectedAtom.reportChanged();
}, _$_imageSelectedAtom, name: '${_$_imageSelectedAtom.name}_set');
}
final _$getImageAsyncAction = AsyncAction('getImage');
@override
Future<dynamic> getImage() {
return _$getImageAsyncAction.run(() => super.getImage());
}
final _$_FileControllerBaseActionController =
ActionController(name: '_FileControllerBase');
@override
void setImageFile({File img}) {
final _$actionInfo = _$_FileControllerBaseActionController.startAction();
try {
return super.setImageFile(img: img);
} finally {
_$_FileControllerBaseActionController.endAction(_$actionInfo);
}
}
@override
void setHeaderText({String text}) {
final _$actionInfo = _$_FileControllerBaseActionController.startAction();
try {
return super.setHeaderText(text: text);
} finally {
_$_FileControllerBaseActionController.endAction(_$actionInfo);
}
}
@override
void setFooterText({String text}) {
final _$actionInfo = _$_FileControllerBaseActionController.startAction();
try {
return super.setFooterText(text: text);
} finally {
_$_FileControllerBaseActionController.endAction(_$actionInfo);
}
}
@override
String toString() {
final string =
'headerText: ${headerText.toString()},footerText: ${footerText.toString()},imageFile: ${imageFile.toString()},image: ${image.toString()},imageSelected: ${imageSelected.toString()}';
return '{$string}';
}
}
| 0 |
mirrored_repositories/flutter-studies/meme-generation | mirrored_repositories/flutter-studies/meme-generation/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meme_generation/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/flutter-studies/phrases_of_the_day | mirrored_repositories/flutter-studies/phrases_of_the_day/lib/main.dart | import 'package:phrases_of_the_day/views/HomeActivity.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.green
),
home: Home(),
));
}
| 0 |
mirrored_repositories/flutter-studies/phrases_of_the_day/lib | mirrored_repositories/flutter-studies/phrases_of_the_day/lib/views/HomeActivity.dart | import 'dart:math';
import 'package:flutter/material.dart';
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
var _phrases = [
"O amor é algo sério. Não menospreze ou ignore este sentimento",
"Sentir amor, fazer amor, viver o amor!",
"O amor dispensa palavras, mas pede por ações",
];
var _currentPhrase = "Click below to generate a phrase!";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Phrases of the day"),
),
body: Center(
child: Container(
padding: EdgeInsets.all(16),
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/image/logo.png"),
Text(
'${_currentPhrase}',
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 25,
fontStyle: FontStyle.italic,
color: Colors.black
),
),
RaisedButton(
child: Text(
"New Phrase",
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
color: Colors.green,
onPressed: () {
_randomPhrases();
},
)
]
)
)
)
);
}
void _randomPhrases() {
setState(() {
_currentPhrase = _phrases[Random().nextInt(_phrases.length)];
});
}
}
| 0 |