Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agregar fuente y lista de polizas #1

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand Down
Binary file added assets/fonts/Alata-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/BalooTamma2-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/BalooTamma2-Regular.ttf
Binary file not shown.
Binary file added assets/icons/car-first.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/car-second.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/car-third.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions lib/model/poliza.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Poliza {
String title;
String img;
bool popular;
int price;
Poliza(
{this.title,
this.img,
this.popular,
this.price
});
}
25 changes: 20 additions & 5 deletions lib/screens/rent_calculator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:project_test_unit/widgets/my_header.dart';
import 'package:project_test_unit/widgets/cool_header.dart';
import 'package:project_test_unit/widgets/poliza_list.dart';
import 'package:project_test_unit/style/theme.dart' as Style;

class RentCalculator extends StatefulWidget {
@override
Expand All @@ -12,8 +14,8 @@ class _RentCalculatorState extends State<RentCalculator> {
var _precio;
var _dias;
var _tipoVehiculo;
var tipoVehiculo= "Tipo vehiculos";
var _total;
var tipoVehiculo = "Tipo vehiculos";
var _total = 0;
final List<String> _vehiculosData = <String>[
"Name1",
"Name2",
Expand All @@ -34,7 +36,7 @@ class _RentCalculatorState extends State<RentCalculator> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
MyHeader(
CoolHeader(
text: "Calculadora de precios",
offset: offset,
),
Expand All @@ -48,6 +50,18 @@ class _RentCalculatorState extends State<RentCalculator> {
decoration: InputDecoration(
hintText: "Ingrese valor de alquiler por hora"),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20.0),
child: Text(
"Póliza de seguro",
style:
TextStyle(fontSize: 20.0, color: Style.Colors.titleColor),
),
),
Container(
height: 275,
child: PolizaList(),
),
RaisedButton(
onPressed: () {
setState(() {
Expand All @@ -57,7 +71,8 @@ class _RentCalculatorState extends State<RentCalculator> {
},
child: Text("Submit"),
),
Text("Total $_total"),
Text("Total \$$_total Días: $_dias",
style: TextStyle(fontFamily: 'Alata', fontSize: 16)),
],
),
),
Expand Down
72 changes: 72 additions & 0 deletions lib/widgets/cool_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';

class CoolHeader extends StatefulWidget {
final String text;
final double offset;
const CoolHeader({Key key, this.text, this.offset}) : super(key: key);

@override
_CoolHeaderState createState() => _CoolHeaderState();
}

class _CoolHeaderState extends State<CoolHeader> {
@override
Widget build(BuildContext context) {
return ClipPath(
clipper: MyClipper(),
child: Container(
padding: EdgeInsets.only(left: 40, top: 50, right: 20),
height: 250,
width: double.infinity,
decoration: BoxDecoration(
gradient: new LinearGradient(
colors: [Colors.blue[300], Colors.blue[200]],
begin: Alignment.centerRight,
end: Alignment.centerLeft),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Expanded(
child: Stack(
children: <Widget>[
Positioned(
top: 45 - widget.offset / 2,
left: 40,
child: Text(
"${widget.text}",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontFamily: 'Baloo',
fontWeight: FontWeight.bold),
),
),
Container(), // I dont know why it can't work without container
],
),
),
],
),
),
);
}
}

class MyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0, size.height - 80);
path.quadraticBezierTo(
size.width / 2, size.height, size.width, size.height - 80);
path.lineTo(size.width, 0);
path.close();
return path;
}

@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
69 changes: 69 additions & 0 deletions lib/widgets/poliza_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:project_test_unit/model/poliza.dart';

class PolizaList extends StatelessWidget {
final foodItems = <Poliza>[
Poliza(
title: "Todo riesgo",
img: 'assets/icons/foods/food5.jpg',
popular: true,
price: 25),
Poliza(
title: "Terceros",
img: 'assets/icons/foods/food5.jpg',
popular: false,
price: 16),
Poliza(
title: "Terceros ampliado",
img: 'assets/icons/foods/food5.jpg',
popular: false,
price: 20)
];
@override
Widget build(BuildContext context) {
return ListView(
scrollDirection: Axis.horizontal,
children: foodItems.map<Widget>((Poliza poliza) {
return GestureDetector(
onTap: () {},
child: Padding(
padding: EdgeInsets.only(
left: 10.0, top: 10.0, bottom: 30, right: 10.0),
child: Container(
width: 170,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey[300], width: 1.0),
borderRadius: BorderRadius.all(Radius.circular(10))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
height: 180.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10)),
),
child: Image.asset('assets/icons/foods/food5.jpg')),
Padding(
padding: const EdgeInsets.only(left: 0),
child: Center(
child: Text(
poliza.title,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 16.0,
fontFamily: 'Baloo'),
),
)),
],
),
),
));
}).toList());
}
}
21 changes: 10 additions & 11 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ flutter:
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
fonts:
- family: Baloo
fonts:
- asset: assets/fonts/BalooTamma2-Regular.ttf
- asset: assets/fonts/BalooTamma2-Bold.ttf
weight: 400
- family: Alata
fonts:
- asset: assets/fonts/Alata-Regular.ttf
weight: 400
assets:
- assets/icons/car1_black.svg
- assets/puntos.png
Expand Down