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

Se hizo lo que se pudo #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Binary file added assets/images/atria.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/images/leick.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/images/lilith.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion lib/data/atria.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import 'package:desafio_flutter_in_the_dark_2/data/character.dart';

class Atria extends Character {
Atria() : super(flightLevel: 10, flameLevel: 20, readMindsLevel: 30);
Atria()
: super(
flightLevel: 10,
flameLevel: 20,
readMindsLevel: 30,
imgSrc: 'assets/images/atria.png',
name: 'Atria');
}
10 changes: 9 additions & 1 deletion lib/data/character.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ abstract class Character {
final int flightLevel;
final int flameLevel;
final int readMindsLevel;
final String imgSrc;
final String name;

Character({this.flightLevel, this.flameLevel, this.readMindsLevel});
Character({
required this.flightLevel,
required this.flameLevel,
required this.readMindsLevel,
required this.imgSrc,
required this.name,
});
}
9 changes: 9 additions & 0 deletions lib/data/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'atria.dart';
import 'leick.dart';
import 'lilith.dart';

final kCharactersList = [
Atria(),
Leick(),
Lilith(),
];
11 changes: 9 additions & 2 deletions lib/data/leick.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import 'package:desafio_flutter_in_the_dark_2/data/character.dart';

class Leick extends Character {
Leick() : super(flightLevel: 2, flameLevel: 40, readMindsLevel: 10);
}
Leick()
: super(
flightLevel: 2,
flameLevel: 40,
readMindsLevel: 10,
imgSrc: 'assets/images/leick.png',
name: 'Leick',
);
}
9 changes: 8 additions & 1 deletion lib/data/lilith.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import 'package:desafio_flutter_in_the_dark_2/data/character.dart';

class Lilith extends Character {
Lilith() : super(flightLevel: 40, flameLevel: 20, readMindsLevel: 40);
Lilith()
: super(
flightLevel: 40,
flameLevel: 20,
readMindsLevel: 40,
imgSrc: 'assets/images/lilith.png',
name: 'Lilith',
);
}
112 changes: 4 additions & 108 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,113 +1,9 @@
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.
import 'src/app.dart';

// 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++;
});
}
void main() {
WidgetsFlutterBinding.ensureInitialized();

@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.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
runApp(MyApp());
}
18 changes: 18 additions & 0 deletions lib/src/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:desafio_flutter_in_the_dark_2/src/features/home/views/home_page.dart';
import 'package:flutter/material.dart';
import 'package:layout/layout.dart';

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Layout(
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
),
);
}
}
1 change: 1 addition & 0 deletions lib/src/core/animations/animations.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'slide_animation.dart';
48 changes: 48 additions & 0 deletions lib/src/core/animations/slide_animation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

class SlideAnimation extends HookWidget {
SlideAnimation({
required this.child,
required this.initialOffset,
this.duration = 600,
this.curve = Curves.bounceOut,
});

final Widget child;
final Offset initialOffset;
final int duration;
final Curve curve;

@override
Widget build(BuildContext context) {
final _duration = Duration(milliseconds: duration);

final animationController = useAnimationController(
duration: _duration,
)..forward();

final slideAnimation = useAnimation(
Tween<double>(begin: 1, end: 0).animate(
CurvedAnimation(
parent: animationController,
curve: curve,
),
),
);

return AnimatedBuilder(
animation: animationController,
builder: (context, child) {
return Transform.translate(
child: AnimatedOpacity(
duration: _duration,
opacity: animationController.value,
child: child,
),
offset: initialOffset * slideAnimation,
);
},
child: child);
}
}
25 changes: 25 additions & 0 deletions lib/src/core/layout/custom_layout_builder.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:layout/layout.dart';

class CustomLayoutBuilder extends StatelessWidget {
const CustomLayoutBuilder({
Key? key,
required this.mobile,
required this.tablet,
required this.desktop,
}) : super(key: key);
final Widget mobile;
final Widget tablet;
final Widget desktop;

@override
Widget build(BuildContext context) {
final bp = context.breakpoint;
if (bp < LayoutBreakpoint.sm) {
return mobile;
} else if (bp < LayoutBreakpoint.md) {
return tablet;
}
return desktop;
}
}
7 changes: 7 additions & 0 deletions lib/src/core/styles/app_colors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:flutter/material.dart';

class AppColors {
static final customBlack = Color(0xff212121);
static final black = Color(0x000000);
static final red = Color(0xffC53232);
}
56 changes: 56 additions & 0 deletions lib/src/core/styles/app_texts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class KronaText extends StatelessWidget {
const KronaText(
this.text, {
this.fontSize = 14,
this.fontWeight = FontWeight.normal,
this.color = Colors.white,
Key? key,
}) : super(key: key);

final String text;
final double fontSize;
final FontWeight fontWeight;
final Color color;

@override
Widget build(BuildContext context) {
return Text(
text,
style: GoogleFonts.kronaOne(
fontSize: fontSize,
fontWeight: fontWeight,
color: color,
),
);
}
}

class JuraText extends StatelessWidget {
const JuraText(
this.text, {
this.fontSize = 14,
this.fontWeight = FontWeight.normal,
this.color = Colors.white,
Key? key,
}) : super(key: key);

final String text;
final double fontSize;
final FontWeight fontWeight;
final Color color;

@override
Widget build(BuildContext context) {
return Text(
text,
style: GoogleFonts.jura(
fontSize: fontSize,
fontWeight: fontWeight,
color: color,
),
);
}
}
2 changes: 2 additions & 0 deletions lib/src/core/styles/styles.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'app_colors.dart';
export 'app_texts.dart';
Loading