-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from fga-eps-mds/feature/98-Productor-details
#98 [US12] - Visualizar Anúncios de um Produtor
- Loading branch information
Showing
21 changed files
with
429 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class ProfilePicture extends StatefulWidget { | ||
final double width; | ||
final double heigth; | ||
final double radius; | ||
final double bottomMargin; | ||
|
||
const ProfilePicture( | ||
{@required this.width, | ||
@required this.heigth, | ||
@required this.radius, | ||
@required this.bottomMargin, | ||
Key key}) | ||
: super(key: key); | ||
@override | ||
_ProfilePictureState createState() => _ProfilePictureState(); | ||
} | ||
|
||
class _ProfilePictureState extends State<ProfilePicture> { | ||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Container( | ||
margin: | ||
EdgeInsets.only(top: size.height * 0.1, bottom: widget.bottomMargin), | ||
width: widget.width, | ||
height: widget.heigth, | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.all(Radius.circular(widget.radius)), | ||
child: Material( | ||
child: InkWell( | ||
child: Image.asset( | ||
'assets/images/perfil.jpg', | ||
fit: BoxFit.fill, | ||
)), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_spinkit/flutter_spinkit.dart'; | ||
|
||
class SpinWidget extends StatefulWidget { | ||
final double margin; | ||
|
||
const SpinWidget({@required this.margin, Key key}) : super(key: key); | ||
|
||
@override | ||
_SpinWidgetState createState() => _SpinWidgetState(); | ||
} | ||
|
||
class _SpinWidgetState extends State<SpinWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
margin: EdgeInsets.only(top: widget.margin), | ||
child: SpinKitCircle( | ||
key: Key('spin'), color: Color(0xff47CC70).withOpacity(0.7))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:dio/dio.dart'; | ||
import 'package:hortum_mobile/globals.dart'; | ||
|
||
class ProductorsDetailsApi { | ||
Dio dio; | ||
List<dynamic> announcements = []; | ||
|
||
ProductorsDetailsApi([Dio client]) { | ||
if (client == null) | ||
this.dio = Dio(); | ||
else | ||
this.dio = client; | ||
} | ||
|
||
Future getDetails(String email) async { | ||
//Trocar o IPLOCAL pelo ip de sua máquina | ||
String url; | ||
url = 'http://$ip:8000/announcement/retrieve/${email}'; | ||
|
||
var header = { | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer " + actualUser.tokenAccess, | ||
}; | ||
Response response = await dio.get(url, options: Options(headers: header)); | ||
this.announcements = response.data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
hortum_mobile/lib/views/productor_details/components/announcements_details.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:hortum_mobile/data/productor_details_backend.dart'; | ||
import 'package:hortum_mobile/views/productor_details/components/announcements_tag.dart'; | ||
import 'package:hortum_mobile/views/productor_details/components/productor_localization.dart'; | ||
import 'package:hortum_mobile/views/productor_details/services/productor_details_services.dart'; | ||
|
||
class AnnouncementsDetails extends StatefulWidget { | ||
final ProductorsDetailsApi prodData; | ||
const AnnouncementsDetails({@required this.prodData, Key key}) | ||
: super(key: key); | ||
|
||
@override | ||
_AnnouncementsDetailsState createState() => _AnnouncementsDetailsState(); | ||
} | ||
|
||
class _AnnouncementsDetailsState extends State<AnnouncementsDetails> { | ||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Container( | ||
width: size.width, | ||
height: size.height * 0.45, | ||
child: ListView( | ||
children: [ | ||
Column( | ||
children: [ | ||
ProductorLocalization(), | ||
AnnouncementTag(), | ||
ProductorDetaislService.completeAnnouncements( | ||
widget.prodData.announcements) | ||
], | ||
), | ||
], | ||
)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
hortum_mobile/lib/views/productor_details/components/announcements_tag.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class AnnouncementTag extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Container( | ||
child: Align( | ||
alignment: Alignment.center, | ||
child: Text('Anúncios', | ||
style: TextStyle( | ||
fontFamily: 'Comfortaa-Bold', | ||
fontWeight: FontWeight.bold, | ||
fontSize: size.height * 0.022))), | ||
margin: | ||
EdgeInsets.only(top: size.height * 0.05, bottom: size.height * 0.03), | ||
width: size.width * 0.5, | ||
height: size.height * 0.04, | ||
decoration: BoxDecoration( | ||
color: Color(0xffA7DDB7), | ||
borderRadius: BorderRadius.all(Radius.circular(15))), | ||
); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
hortum_mobile/lib/views/productor_details/components/name_actions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class NameActionsWidget extends StatefulWidget { | ||
final String name; | ||
|
||
const NameActionsWidget({@required this.name, Key key}) : super(key: key); | ||
|
||
@override | ||
_NameActionsWidgetState createState() => _NameActionsWidgetState(); | ||
} | ||
|
||
class _NameActionsWidgetState extends State<NameActionsWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Padding( | ||
padding: EdgeInsets.only(left: size.width * 0.25), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text(widget.name, | ||
style: TextStyle( | ||
fontFamily: 'Roboto-Bold', | ||
fontWeight: FontWeight.bold, | ||
fontSize: 25)), | ||
IconButton( | ||
padding: EdgeInsets.only(left: 10), | ||
icon: Icon(Icons.ios_share, color: Color(0xffA7DDB7)), | ||
onPressed: () {}), | ||
IconButton( | ||
padding: EdgeInsets.only(top: 5, right: 10), | ||
icon: Icon(Icons.report, color: Color(0xffFF4D00)), | ||
onPressed: () {}), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.