diff --git a/lib/screens/products/item_list_page.dart b/lib/screens/products/item_list_page.dart index 8b728b5..a9495d0 100644 --- a/lib/screens/products/item_list_page.dart +++ b/lib/screens/products/item_list_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:saphy/utils/colors.dart'; import 'package:saphy/utils/textstyles.dart'; +import 'package:saphy/widgets/app_bar.dart'; import 'package:saphy/widgets/product_card.dart'; import 'package:dio/dio.dart'; import 'package:saphy/models/product.dart'; @@ -59,10 +60,9 @@ class _ItemListPageState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xfff4f4f4), - appBar: _appBar(), + appBar: TopAppBar(label: widget.name), body: CustomScrollView( slivers: [ - _buildHeader(), const SliverToBoxAdapter( child: SizedBox(height: 10), ), @@ -73,51 +73,6 @@ class _ItemListPageState extends State { ); } - AppBar _appBar() { - return AppBar( - automaticallyImplyLeading: false, - backgroundColor: altWhite, - title: Padding( - padding: const EdgeInsets.only(top: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - icon: const Icon( - Icons.arrow_back_ios, - size: 25, - ), - onPressed: () { - Navigator.pop(context); - }, - ), - IconButton( - icon: const Icon( - Icons.search, - size: 25, - ), - onPressed: () {}, - ), - ], - ), - ), - ); - } - - SliverToBoxAdapter _buildHeader() { - return SliverToBoxAdapter( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 30.0, - ), - child: Text( - widget.name, - style: titleText(), - ), - ), - ); - } - SliverPadding _buildSorter() { return SliverPadding( padding: const EdgeInsets.symmetric(horizontal: 30), diff --git a/lib/screens/products/liked_list_page.dart b/lib/screens/products/liked_list_page.dart index 0a77dff..ba9292a 100644 --- a/lib/screens/products/liked_list_page.dart +++ b/lib/screens/products/liked_list_page.dart @@ -6,6 +6,7 @@ import 'package:saphy/models/product.dart'; import 'package:saphy/utils/textstyles.dart'; import 'package:saphy/widgets/product_card.dart'; import 'package:saphy/utils/colors.dart'; +import 'package:saphy/widgets/app_bar.dart'; class LikedListPage extends StatefulWidget { const LikedListPage({super.key}); @@ -19,27 +20,9 @@ class _LikedListPageState extends State { @override Widget build(BuildContext context) { - var screenWidth = MediaQuery.of(context).size.width; return Scaffold( backgroundColor: const Color(0xfff4f4f4), - appBar: AppBar( - backgroundColor: altWhite, - title: Padding( - padding: const EdgeInsets.only(top: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - IconButton( - icon: const Icon(Icons.arrow_back_ios, size: 25), - onPressed: () {}, - ), - SizedBox(height: 50, width: screenWidth - 150), - IconButton( - icon: const Icon(Icons.search, size: 25), onPressed: () {}), - ], - ), - ), - ), + appBar: const TopAppBar(label: "찜 목록"), body: CustomScrollView( slivers: [ SliverPadding( diff --git a/lib/widgets/app_bar.dart b/lib/widgets/app_bar.dart index 92bdba3..c211f61 100644 --- a/lib/widgets/app_bar.dart +++ b/lib/widgets/app_bar.dart @@ -1,30 +1,43 @@ import 'package:flutter/material.dart'; +import 'package:saphy/utils/colors.dart'; +import 'package:saphy/utils/textstyles.dart'; class TopAppBar extends StatelessWidget implements PreferredSizeWidget { final AppBar? appBar; - const TopAppBar({super.key, this.appBar}); + final String? label; + const TopAppBar({super.key, this.appBar, this.label}); @override Widget build(BuildContext context) { return AppBar( - backgroundColor: Colors.white, - title: Padding( - padding: const EdgeInsets.only(left: 20.0), - child: Image.asset( - "assets/images/SaphyLogoSmall.png", - height: 24, - ), - ), - centerTitle: false, - actions: [ - Padding( - padding: const EdgeInsets.only(right: 20.0), - child: IconButton( - icon: const Icon(Icons.notifications_outlined), + toolbarHeight: 70, + automaticallyImplyLeading: false, + backgroundColor: altWhite, + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: const Icon( + Icons.arrow_back_ios, + size: 25, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + Text( + label ?? "", + style: titleText(), + ), + IconButton( + icon: const Icon( + Icons.search, + size: 25, + ), onPressed: () {}, ), - ), - ], + ], + ), ); }