Untitled

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomePage(),
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: ThemeMode.dark,
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("설정"),
      ),
      body: Padding(
        padding: const EdgeInsets.only(left: 16, right: 16),
        child: ListView(
          children: [
            CustomSearch(),
            SizedBox(height: 20),
            CustomAccount(),
            SizedBox(height: 20),

            // 첫번째 박스
            CustomCard(Icons.airplanemode_active, Colors.orange, "에어플레인 모드"),
            Divider(height: 1),
            CustomCard(Icons.wifi, Colors.blue, "Wi-Fi"),
            Divider(height: 1),
            CustomCard(Icons.bluetooth, Colors.blue, "Bluetooth"),
            Divider(height: 1),
            CustomCard(Icons.network_cell, Colors.green, "셀룰러"),
            Divider(height: 1),
            CustomCard(Icons.battery_full, Colors.green, "배터리"),
            SizedBox(height: 20),

            // 두번째 박스
            CustomCard(Icons.airplanemode_active, Colors.orange, "에어플레인 모드"),
            Divider(height: 1),
            CustomCard(Icons.wifi, Colors.blue, "Wi-Fi"),
            Divider(height: 1),
            CustomCard(Icons.bluetooth, Colors.blue, "Bluetooth"),
            Divider(height: 1),
            CustomCard(Icons.network_cell, Colors.green, "셀룰러"),
            Divider(height: 1),
            CustomCard(Icons.battery_full, Colors.green, "배터리"),
            SizedBox(height: 20),
          ],
        ),
      ),
    );
  }
}

class CustomCard extends StatelessWidget {
  final icon;
  final iconColor;
  final title;

  CustomCard(this.icon, this.iconColor, this.title);

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16), color: kSecondaryColor),
      child: ListTile(
        leading: Icon(
          icon,
          color: iconColor,
        ),
        title: Text("${title}"),
        trailing: IconButton(
          icon: Icon(Icons.chevron_right),
          onPressed: () {},
        ),
      ),
    );
  }
}

class CustomAccount extends StatelessWidget {
  const CustomAccount({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16), color: kSecondaryColor),
      child: ListTile(
        leading: CircleAvatar(
          backgroundImage: NetworkImage("<https://picsum.photos/id/200/100/100>"),
        ),
        title: Text("홍길동"),
        subtitle: Text("Apple 계정, iCloud 등"),
        trailing: IconButton(
          icon: Icon(Icons.chevron_right),
          onPressed: () {},
        ),
      ),
    );
  }
}

class CustomSearch extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TextField(
      decoration: InputDecoration(
        hintText: "검색",
        prefixIcon: Icon(Icons.search),
        border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(30),
            borderSide: BorderSide.none),
        filled: true,
        fillColor: kSecondaryColor,
      ),
    );
  }
}

final kSecondaryColor = Color(0xFF1E1E1E);