Untitled

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BPage extends StatelessWidget {
  BPage();

  @override
  Widget build(BuildContext context) {
    print("BPage");
    return Scaffold(
      appBar: _appbar(),
      body: CustomScrollView(
        slivers: [
          SliverToBoxAdapter(
            child: LifeHeader(),
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              childCount: 10,
              (context, index) {
                return LifeCard();
              },
            ),
          ),
        ],
      ),
    );
  }

  // 여기 위치
  AppBar _appbar() {
    return AppBar(
      title: const Row(
        children: [Text("동네생활")],
      ),
      actions: [
        IconButton(onPressed: () {}, icon: const Icon(CupertinoIcons.search)),
        IconButton(
            onPressed: () {}, icon: const Icon(CupertinoIcons.list_dash)),
        IconButton(onPressed: () {}, icon: const Icon(CupertinoIcons.bell)),
      ],
      bottom: const PreferredSize(
        preferredSize: Size.fromHeight(0.5),
        child: Divider(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        LifeLine(),
        Padding(
          padding: const EdgeInsets.all(16.0),
          child: LifeItem(),
        ),
      ],
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text("우리동네질문"),
            Text("3시간전"),
          ],
        ),
        SizedBox(height: 6),
        Row(
          children: [
            CircleAvatar(
              backgroundImage: NetworkImage(
                "<https://picsum.photos/id/200/100/100>",
              ),
            ),
            SizedBox(width: 6),
            Text("헬로비비"),
            SizedBox(width: 6),
            Text("좌동 인증 3회", style: TextStyle(color: Colors.grey)),
          ],
        ),
        SizedBox(height: 6),
        Text(
          "예민한 개도 미용할 수 있는 곳이나 동물 병원 어디 있을가요? 내일 유기견을 데려오기로 했는데 아직 성향을 잘 몰라서 걱정이 돼요ㅜㅜ,",
          maxLines: 3,
          overflow: TextOverflow.ellipsis,
        ),
        SizedBox(height: 6),
        AspectRatio(
          aspectRatio: 7 / 3,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(10),
            child: Image.network("<https://picsum.photos/id/234/400/300>",
                fit: BoxFit.cover),
          ),
        ),
        SizedBox(height: 6),
        Divider(),
        SizedBox(height: 6),
        Row(
          children: [
            Icon(CupertinoIcons.smiley),
            Text("공감하기"),
            SizedBox(width: 10),
            Icon(Icons.chat_bubble_outline),
            Text("댓글쓰기"),
          ],
        )
      ],
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Divider(
          height: 2,
          thickness: 2,
        ),
        Divider(
          height: 8,
          thickness: 8,
          color: Colors.grey[200],
        ),
      ],
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 10),
      child: Row(
        children: [
          ClipRRect(
            borderRadius: BorderRadius.circular(6),
            child: SizedBox(
              width: 50,
              height: 50,
              child: Image.network(
                "<https://picsum.photos/id/354/100/100>",
                fit: BoxFit.cover,
              ),
            ),
          ),
          SizedBox(width: 16),
          Expanded(
            child: Text(
              "이웃과 함께 만드는 봄 간식입니다. 마음까지 따뜻해지는 봄 간식을 만나보세요.",
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
            ),
          )
        ],
      ),
    );
  }
}