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

S00E02 #23

Open
wants to merge 5 commits into
base: main
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
81 changes: 81 additions & 0 deletions Subject_00/ex01/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import 'package:flutter/material.dart';

void main() => runApp(CounterPage());

class CounterPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => Counter();
}

class Counter extends State<CounterPage> {
int value = 0;

@override
Widget build(BuildContext context) {
ButtonStyle btnStyle = ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Colors.green,
),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0),
),
),
minimumSize: MaterialStateProperty.all<Size>(
Size(
60,
60,
),
),
elevation: MaterialStateProperty.all(10),
);
final _increaseCount = () => setState(() => value++);
final _decreaseCount = () => setState(() => value--);
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "Hello Flutter",
home: Scaffold(
appBar: AppBar(
centerTitle: false,
title: Text("Hello Flutter"),
backgroundColor: Colors.green,
),
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text("You have pushed the button this many times:")),
Center(
child: Text(
"$value",
style: TextStyle(
fontSize: 30,
color: Colors.grey,
),
)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () => _increaseCount(),
child: Text("+"),
style: btnStyle,
),
SizedBox(
width: 100,
),
ElevatedButton(
onPressed: () => _decreaseCount(),
child: Text("-"),
style: btnStyle,
)
],
)
],
),
),
),
);
}
}
56 changes: 56 additions & 0 deletions Subject_00/ex02/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,60 @@ class MyPage extends StatelessWidget {
body: _buildBody(),
);
}

PreferredSizeWidget _buildAppBar() => AppBar(
centerTitle: false,
title: Text("Stateless? or Stateful?"),
backgroundColor: Colors.green,
);

Widget _buildBody() => MyBody(count: count);
}

class MyBody extends StatefulWidget {
const MyBody({Key key, this.count}) : super(key: key);
final int count;

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

class _MyBodyState extends State<MyBody> {
int _count = 41;
ButtonStyle btnStyle = ButtonStyle(
backgroundColor: MaterialStateProperty.all(
Colors.green,
),
elevation: MaterialStateProperty.all(10),
);

@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
widget.count == 0 ? _count.toString() : 0.toString(),
style: TextStyle(
fontSize: 40,
),
),
ElevatedButton(
onPressed: () {
setState(() => _count++);
if (_count == 42)
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('answer to life the universe and everything'),
),
);
},
child: Text("Add"),
style: btnStyle,
),
],
),
);
}
}
31 changes: 31 additions & 0 deletions Subject_00/ex03/custom_widget/blur_image.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BlurImage extends StatelessWidget {
const BlurImage({
Key key,
@required this.mainImageUrl,
}) : super(key: key);

final String mainImageUrl;

@override
Widget build(BuildContext context) {
return Container(
foregroundDecoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.black,
Colors.transparent,
Colors.transparent,
Colors.black,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.2, 0.8, 0.1, 0.9],
),
),
child: Image.network(mainImageUrl),
);
}
}
80 changes: 80 additions & 0 deletions Subject_00/ex03/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import 'package:flutter/material.dart';

import 'custom_widget/blur_image.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) {
TextStyle tt = TextStyle(
color: Colors.white,
);
String mainImageUrl =
'https://maxmovie.cdnsave.com/images/1628644797279L0zPH.jpg';
String titleImageUrl =
'https://w.namu.la/s/420422c9668360c3654fb8d4ba4b4921a22a8732d660e08d81cfa5281035aae6573a4f61927aaeecdcf6ee911af6ea5a4aa49bef54be3f63ada78ac5f914e1cfb4b78e644e2190944fb886f2688ffb91';
return MaterialApp(
title: 'Day00_Ex03',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: Container(
color: Colors.black,
child: Column(
children: [
Expanded(
child: Stack(
children: [
BlurImage(mainImageUrl: mainImageUrl),
Positioned(
top: 50,
right: 0,
left: 0,
child: Image.network(titleImageUrl),
),
Positioned(
right: 5,
left: 5,
bottom: 50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Title: Squeid Game 2021",
style: tt,
),
SizedBox(height: 10),
Text(
"Episodes: 1",
style: tt,
),
SizedBox(height: 10),
Text(
"Genre: TV Drama",
style: tt,
),
SizedBox(height: 10),
Text(
"Plot: Seong Gi-hun, a divorced and indebted chauffeur, is invited to play a series of childrent's games for a chance at a large cash prize. Accepting the offer, he is taken to an unknown locaiton where he finds himself among 456 playes who are all deeply in debt. The players are made to wear green tacksuits and are kept under watch a t all times by masked guqrds in pink jumpsuits, with the games overseen by the Front Man, who wears a black mask and black uniform.",
style: tt,
)
],
),
),
],
),
),
],
),
),
),
);
}
}
114 changes: 114 additions & 0 deletions Subject_00/ex04/custom_widget/pockemon_details.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PoketmonDetails extends StatelessWidget {
const PoketmonDetails({
Key key,
@required this.mainImageUrl,
@required this.headerText,
@required this.MainText,
@required this.descriptionText,
}) : super(key: key);

final String mainImageUrl;
final TextStyle headerText;
final TextStyle MainText;
final TextStyle descriptionText;

@override
Widget build(BuildContext context) {
return Container(
color: Color(0xFFFCDA6E),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
Center(
child: Container(
height: 250,
width: 250,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
fit: BoxFit.cover,
image: Image.network(mainImageUrl).image,
),
),
),
),
SizedBox(height: 20),
Container(
width: double.infinity,
height: 1,
color: Colors.grey.shade400,
),
SizedBox(
height: 20,
),
Text(
"Name",
style: headerText,
),
Text(
"Pickachu",
style: MainText,
),
Text(
"Level",
style: headerText,
),
Text(
"Lv.4",
style: MainText,
),
SizedBox(
height: 20,
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 5,
),
Text(
"Body Blow",
style: descriptionText,
),
],
),
SizedBox(height: 10),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 5,
),
Text(
"Eletric Shocks",
style: descriptionText,
),
],
),
SizedBox(height: 10),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 5,
),
Text(
"Electro Bail",
style: descriptionText,
),
],
),
],
),
),
);
}
}
Loading