Open jnjosjk0965 opened 4 months ago
import 'package:flutter/material.dart';
class Button extends StatelessWidget { final String text; final Color backgroundColor; final Color textColor;
const Button({ super.key, required this.text, required this.backgroundColor, required this.textColor, });
@override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( color: backgroundColor, borderRadius: BorderRadius.circular(45), ), child: Padding( padding: const EdgeInsets.symmetric( vertical: 20, horizontal: 50, ), child: Text( text, style: TextStyle( fontSize: 18, color: textColor, ), ), ), ); } }
widgets/currency_card.dart
import 'package:flutter/material.dart';
class CurrencyCard extends StatelessWidget { final String name, code, amount; final IconData icon; final bool isInverted; final int order;
final Color _blackColor = const Color(0xFF1F2123);
const CurrencyCard({ super.key, required this.name, required this.code, required this.amount, required this.icon, required this.isInverted, required this.order, });
@override Widget build(BuildContext context) { return Transform.translate( offset: Offset(0, -20 * (order - 1)), child: Container( clipBehavior: Clip.hardEdge, decoration: BoxDecoration( color: isInverted ? Colors.white : _blackColor, borderRadius: BorderRadius.circular(25), ), child: Padding( padding: const EdgeInsets.symmetric( vertical: 25, horizontal: 30, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( name, style: TextStyle( color: isInverted ? _blackColor : Colors.white, fontSize: 32, fontWeight: FontWeight.w600, ), ), const SizedBox( height: 15, ), Row( children: [ Text( amount, style: TextStyle( color: isInverted ? _blackColor : Colors.white, fontSize: 18, ), ), const SizedBox( width: 5, ), Text( code, style: TextStyle( color: isInverted ? _blackColor.withOpacity(0.8) : Colors.white.withOpacity(0.8), ), ) ], ), ], ), Transform.scale( scale: 2.2, child: Transform.translate( offset: const Offset(5, 12), child: Icon( icon, color: isInverted ? _blackColor : Colors.white, size: 88, ), ), ), ], ), ), ), ); } }
main.dart
import 'package:flutter/material.dart'; import 'package:toonflix/widgets/button.dart'; import 'package:toonflix/widgets/currency_cart.dart';
void main() { runApp(const App()); // import 된 함수 }
class App extends StatelessWidget { const App({super.key}); // root @override Widget build(BuildContext context) { /*1. material -> 구글의 디자인 시스템