import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Main()
);
}
}
class Main extends StatefulWidget{
@override
_MainState createState() => _MainState();
}
class _MainState extends State<Main> {
bool isChart = false;
bool isAnim = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(vertical: 30.0),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage("https://cdn.pixabay.com/photo/2020/12/06/16/16/cosmos-5809271__480.png")
)
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width/2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
!isAnim
? GestureDetector(
onTap: (){
setState(() {
isAnim = !isAnim;
});
Future.delayed(Duration(seconds: 3), (){
setState(() {
isAnim = !isAnim;
});
});
},
child: Container(
margin: EdgeInsets.all(20.0),
width: MediaQuery.of(context).size.width*0.40,
height: MediaQuery.of(context).size.width*0.40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(MediaQuery.of(context).size.width/2),
border: Border.all(color: Colors.white, width: 6.0),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage("https://file.mk.co.kr/meet/neds/2021/05/image_readtop_2021_469386_16210389154646222.jfif")
)
),
),
)
: Container(
margin: EdgeInsets.all(20.0),
width: MediaQuery.of(context).size.width*0.40,
height: MediaQuery.of(context).size.width*0.40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(MediaQuery.of(context).size.width/2),
border: Border.all(color: Colors.white, width: 6.0),
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage("https://d2u3dcdbebyaiu.cloudfront.net/uploads/atch_img/674/86fddb4dfe1ed31cef705dec5236483d_a.gif")
)
),
),
Container(
padding: EdgeInsets.all(20.0),
child: Text(
"Doge ????",
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
color: Colors.white
),
),
),
GestureDetector(
onTap: (){
setState((){
isChart = !isChart;
});
},
child: Container(
color: Colors.white,
width: MediaQuery.of(context).size.width*0.40,
padding: EdgeInsets.symmetric(horizontal: 20.0,vertical: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
true
? Icon(Icons.trending_up, color:Colors.red)
: Icon(Icons.trending_down, color:Colors.blue),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"₩776.45",
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
Text(
"+220.5",
style: TextStyle(
color: Colors.red
),
)
],
),
),
],
),
),
),
Container(
width: MediaQuery.of(context).size.width*0.40,
height: MediaQuery.of(context).size.width*0.40,
padding: EdgeInsets.all(20.0),
margin: EdgeInsets.only(top: 30.0),
color: Colors.white,
child: Column(
children: [
Expanded(
child: GestureDetector(
child: Container(
color: Colors.red,
alignment: Alignment.center,
child: Text(
"매수",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold
),
)
),
onTap: () async{
await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("매수"),
)
);
},
)
),
Expanded(
child: Container(),
),
Expanded(
child: GestureDetector(
child: Container(
color: Colors.blue,
alignment: Alignment.center,
child: Text(
"매도",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold
),
)
),
onTap: () async{
await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("매도"),
)
);
},
)
),
],
),
),
],
),
),
],
),
),
Container(
child: Expanded(
child: Container(
padding: EdgeInsets.only(
left: 20.0,
top: 30.0,
bottom: 30.0
),
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
mainAxisSpacing: 10.0,
crossAxisSpacing: 10.0
),
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) => GestureDetector(
onTap: (){
Navigator.of(context).push(
MaterialPageRoute(builder: (BuildContext context) => Scaffold(appBar: AppBar(), body: Center(child: Text("JamesDev - Flutter 2.2"),),))
);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
border: Border.all(color: Colors.white, width: 6.0)
),
child: Center(
child: Text(
" - Coin News - ",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 22.0
),
),
),
),
)
),
),
),
)
]
)
),
isChart
? Positioned(
top: 0,
right: 0,
width: 200.0,
bottom: 0,
child: Container(
padding: EdgeInsets.symmetric(vertical: 30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListView.builder(
itemCount: 20,
padding: EdgeInsets.zero,
reverse: true,
itemBuilder: (BuildContext context, int index) => Container(
color: Colors.red,
padding: EdgeInsets.symmetric(
vertical: 20.0
),
alignment: Alignment.center,
child: GestureDetector(
onTap: () async{
await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("${776.45+(index+1)}원 매수 주문"),
actions: [
TextButton(
child: Text("승인"),
onPressed: (){},
),
TextButton(
child: Text("취소"),
onPressed: (){},
),
],
)
);
},
child: Text("매수 ${776.45+index+1}원, ${index+1}개",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),)
),
)
)
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: 20,
itemBuilder: (BuildContext context, int index) => Container(
color: Colors.blue,
padding: EdgeInsets.symmetric(
vertical: 20.0
),
alignment: Alignment.center,
child: GestureDetector(
onTap: () async{
await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text("${776.45-(index+1)}원 매도 주문"),
actions: [
TextButton(
child: Text("승인"),
onPressed: (){},
),
TextButton(
child: Text("취소"),
onPressed: (){},
),
],
),
);
},
child: Text("매도 ${776.45-(index+1)}원, ${index+1}개",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),)
),
)
)
),
],
),
),
)
: Container(),
isChart
? Positioned(
top: 0,
left: 0,
right: 200.0,
bottom: 0,
child: GestureDetector(
onTap: (){
setState(() {
isChart = !isChart;
});
},
child: Opacity(
opacity: 0.4,
child: Container(
color: Colors.black
),
),
)
)
: Container()
],
)
);
}
}
코드 분리 없이
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.