Skip to content

Instantly share code, notes, and snippets.

@tiagolpadua
Last active November 11, 2021 02:08
Show Gist options
  • Save tiagolpadua/43c7726b8c602ea5a32868ebc968f6ee to your computer and use it in GitHub Desktop.
Save tiagolpadua/43c7726b8c602ea5a32868ebc968f6ee to your computer and use it in GitHub Desktop.
Telas Desafio Semana 2 - Yes She Codes
class CharacterScreen extends StatefulWidget {
Character character;
CharacterScreen({this.character});
@override
_CharacterScreenState createState() => _CharacterScreenState();
}
class _CharacterScreenState extends State<CharacterScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: houseColor,
title: Text(
widget.character.name,
style: TextStyle(
fontWeight: FontWeight.w700,
),
),
),
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.fromLTRB(20, 50, 20, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.network(
widget.character.image,
width: 100,
),
SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.character.name,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
),
),
Text(
widget.character.house,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w400,
),
),
],
),
Expanded(
child: Align(
child: Liked(
isSelected: _favorite == 0 ? false: true,
onPressed: () {}
),
alignment: Alignment.centerRight,
),
)
]
),
SizedBox(height: 15),
Divider(),
SizedBox(height: 15),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: <TextSpan>[
TextSpan(text: 'Nome: ', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: widget.character.name),
],
),
),
SizedBox(height: 10),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: <TextSpan>[
TextSpan(text: 'Casa: ', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: widget.character.house),
],
),
),
SizedBox(height: 10),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: <TextSpan>[
TextSpan(text: 'Ator(a): ', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: widget.character.actor),
],
),
),
SizedBox(height: 10),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: <TextSpan>[
TextSpan(text: 'Aluno(a): ', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: widget.character.hogwartsStudent ? "Sim": "Não"),
],
),
),
SizedBox(height: 10),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: <TextSpan>[
TextSpan(text: 'Aniversário: ', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(text: widget.character.dateOfBirth),
],
),
),
SizedBox(height: 10),
RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 22
),
children: [
TextSpan(text: 'Cor dos olhos: ', style: TextStyle(fontWeight: FontWeight.bold)),
WidgetSpan(child: Icon(Icons.remove_red_eye, color: eyeColors(),))
],
),
),
],
),
SizedBox(height: 30,),
],
),
),
),
);
}
}
class FavoriteScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
extendBodyBehindAppBar: true,
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.transparent,
title: Text(
'Personagens Favoritos',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Image.asset(
"assets/images/harry_bg.jpg",
fit: BoxFit.fitWidth,
width: double.infinity,
height: 200,
),
Expanded(?),
]),
);
}
}
class CharacterItem extends StatelessWidget {
final Character character;
CharacterItem(this.character);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Card(
child: ListTile(
title: Text(character.name, style: TextStyle(fontSize: 20),),
),
),
);
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
extendBodyBehindAppBar: true,
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.transparent,
title: Text(
'Harry Challenge',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
body: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Image.asset(
"assets/images/harry_bg.jpg",
fit: BoxFit.fitWidth,
width: double.infinity,
height: 200,
),
Expanded(?),
]),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.black,
child: Icon(Icons.favorite,),
onPressed: () {},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment