Skip to content

Instantly share code, notes, and snippets.

@jwson-automation
Created May 3, 2024 03:44

Revisions

  1. jwson-automation created this gist May 3, 2024.
    277 changes: 277 additions & 0 deletions main.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,277 @@
    import 'package:flutter/material.dart';
    import 'package:flutter_riverpod/flutter_riverpod.dart';

    void main() {
    runApp(
    ProviderScope(
    child: MyApp(),
    ),
    );
    }

    class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    debugShowCheckedModeBanner: false,
    title: 'Event Detail Page',
    theme: ThemeData(
    primarySwatch: Colors.red,
    visualDensity: VisualDensity.adaptivePlatformDensity,
    ),
    home: DetailPage(),
    );
    }
    }

    class DetailPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return Scaffold(
    appBar: AppBar(
    title: Text('5월 가정의 달 세일'),
    backgroundColor: Colors.red,
    ),
    body: ListView(
    children: [
    _buildTopBanner(),
    _buildCouponSection(),
    _buildRecommendationSection(),
    _buildPromotionSection(),
    ],
    ),
    );
    }

    Widget _buildTopBanner() {
    return Container(
    color: Colors.yellow[700],
    padding: EdgeInsets.all(16.0),
    child: Column(
    children: [
    Text(
    '잠깐! 10만원 쿠폰팩+해택 증정!',
    style: TextStyle(
    fontSize: 24.0,
    fontWeight: FontWeight.bold,
    color: Colors.white,
    ),
    ),
    SizedBox(height: 8.0),
    Text(
    '5월이즈백! 국내여행 빅 세일',
    style: TextStyle(
    fontSize: 30.0,
    fontWeight: FontWeight.bold,
    color: Colors.red[800],
    ),
    ),
    SizedBox(height: 16.0),
    Image.network(
    'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-TUBHLKYl2lBqM1b7iE99XgMQ%2Fuser-UjOypK7HRZS7bCpwDOO1UgLB%2Fimg-z6acNGueI3lwjMYVx6pHQMyB.png%3Fst%3D2024-05-03T02%253A44%253A24Z%26se%3D2024-05-03T04%253A44%253A24Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2024-05-02T23%253A30%253A37Z%26ske%3D2024-05-03T23%253A30%253A37Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DyeUUda0bkOiGSdvSSZqeNqAfPoiUS4FU7BpIj7bGoUQ%253D',
    fit: BoxFit.cover,
    ),
    ],
    ),
    );
    }

    Widget _buildCouponSection() {
    return Container(
    color: Colors.red,
    padding: EdgeInsets.all(16.0),
    child: Column(
    children: [
    Text(
    '놓칠 수 없는 5월의 혜택!',
    style: TextStyle(
    fontSize: 20.0,
    fontWeight: FontWeight.bold,
    color: Colors.white,
    ),
    ),
    SizedBox(height: 8.0),
    Text(
    '최대 10만원 할인 쿠폰순 쿠폰팩',
    style: TextStyle(
    fontSize: 24.0,
    fontWeight: FontWeight.bold,
    color: Colors.yellow[700],
    ),
    ),
    SizedBox(height: 16.0),
    Container(
    padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
    decoration: BoxDecoration(
    color: Colors.white,
    borderRadius: BorderRadius.circular(8.0),
    ),
    child: Text(
    'COUPON',
    style: TextStyle(
    fontSize: 30.0,
    fontWeight: FontWeight.bold,
    color: Colors.red,
    ),
    ),
    ),
    SizedBox(height: 16.0),
    ElevatedButton(
    onPressed: () {},
    child: Text('쿠폰 받아보기'),
    style: ElevatedButton.styleFrom(
    primary: Colors.yellow[700],
    padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0),
    ),
    ),
    ],
    ),
    );
    }

    Widget _buildRecommendationSection() {
    return Container(
    color: Colors.grey[200],
    padding: EdgeInsets.all(16.0),
    child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
    Text(
    '매진 주의! 빠르게 예약하세요',
    style: TextStyle(
    fontSize: 20.0,
    fontWeight: FontWeight.bold,
    color: Colors.black,
    ),
    ),
    SizedBox(height: 8.0),
    Text(
    '이번 주 국내 여행 오픈런 라인업',
    style: TextStyle(
    fontSize: 24.0,
    fontWeight: FontWeight.bold,
    color: Colors.red,
    ),
    ),
    SizedBox(height: 16.0),
    _buildHotelCard('호텔1', '88,830원', '87%', '66,000원'),
    _buildHotelCard('호텔2', '111,300원', '79%', '52,000원'),
    SizedBox(height: 16.0),
    ElevatedButton(
    onPressed: () {},
    child: Text('자세히 보기'),
    style: ElevatedButton.styleFrom(
    primary: Colors.black,
    padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0),
    ),
    ),
    ],
    ),
    );
    }

    Widget _buildHotelCard(String hotelName, String price, String discount, String originalPrice) {
    return Card(
    margin: EdgeInsets.symmetric(vertical: 8.0),
    child: Padding(
    padding: EdgeInsets.all(16.0),
    child: Row(
    children: [
    Image.network(
    'https://corsproxy.io/?https%3A%2F%2Foaidalleapiprodscus.blob.core.windows.net%2Fprivate%2Forg-TUBHLKYl2lBqM1b7iE99XgMQ%2Fuser-UjOypK7HRZS7bCpwDOO1UgLB%2Fimg-W90hwQTpRTFnl84lo9lDeziL.png%3Fst%3D2024-05-03T02%253A44%253A29Z%26se%3D2024-05-03T04%253A44%253A29Z%26sp%3Dr%26sv%3D2021-08-06%26sr%3Db%26rscd%3Dinline%26rsct%3Dimage%2Fpng%26skoid%3D6aaadede-4fb3-4698-a8f6-684d7786b067%26sktid%3Da48cca56-e6da-484e-a814-9c849652bcb3%26skt%3D2024-05-02T23%253A33%253A15Z%26ske%3D2024-05-03T23%253A33%253A15Z%26sks%3Db%26skv%3D2021-08-06%26sig%3DsIkyy3W9gxlFJC140lpDLOkqNBKj0H7hg6phUEIOrsw%253D',
    width: 100,
    height: 100,
    fit: BoxFit.cover,
    ),
    SizedBox(width: 16.0),
    Expanded(
    child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
    Text(
    hotelName,
    style: TextStyle(
    fontSize: 18.0,
    fontWeight: FontWeight.bold,
    ),
    ),
    SizedBox(height: 8.0),
    Text(
    '$price',
    style: TextStyle(
    fontSize: 16.0,
    color: Colors.red,
    fontWeight: FontWeight.bold,
    ),
    ),
    SizedBox(height: 4.0),
    Text(
    '할인 $discount',
    style: TextStyle(
    fontSize: 14.0,
    color: Colors.grey,
    ),
    ),
    Text(
    '정가 $originalPrice',
    style: TextStyle(
    fontSize: 14.0,
    color: Colors.grey,
    decoration: TextDecoration.lineThrough,
    ),
    ),
    ],
    ),
    ),
    ],
    ),
    ),
    );
    }

    Widget _buildPromotionSection() {
    return Container(
    padding: EdgeInsets.all(16.0),
    child: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
    Text(
    '결제 수단까지 더나진 않은 혜택!',
    style: TextStyle(
    fontSize: 20.0,
    fontWeight: FontWeight.bold,
    color: Colors.black,
    ),
    ),
    SizedBox(height: 8.0),
    Text(
    '최대 1만원 실착순 결제시 할인',
    style: TextStyle(
    fontSize: 24.0,
    fontWeight: FontWeight.bold,
    color: Colors.red,
    ),
    ),
    SizedBox(height: 16.0),
    _buildPromotionCard('toss pay', '10%', '3만원 이상 결제 시 최대 1만원'),
    _buildPromotionCard('toss pay', '2,000원', '2만원 이상 결제 시'),
    _buildPromotionCard('toss pay', '20,000원', '20만원 이상 결제 시'),
    _buildPromotionCard('toss pay', '5천원 캐시백', '5천원 캐시백'),
    // Repeat for other payment methods
    ],
    ),
    );
    }

    Widget _buildPromotionCard(String paymentMethod, String discount, String condition) {
    return Card(
    margin: EdgeInsets.symmetric(vertical: 8.0),
    child: ListTile(
    leading: Icon(Icons.payment),
    title: Text(paymentMethod),
    subtitle: Text('$discount 할인'),
    trailing: Text(condition),
    ),
    );
    }
    }