Skip to content

Commit

Permalink
Wip: 작업중..
Browse files Browse the repository at this point in the history
  • Loading branch information
Yellowtoast committed Feb 26, 2024
1 parent c5f4823 commit 9bc9110
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 73 deletions.
76 changes: 45 additions & 31 deletions lib/app/router/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ enum AppRoute {
const AppRoute();

String get path => '/${this.name}';
String get chileRoutePath => '${this.name}';
String get childRoutePath => '${this.name}';
}

@riverpod
Expand All @@ -48,7 +48,23 @@ GoRouter goRouter(GoRouterRef ref) {
initialLocation: AppRoute.splash.path,
navigatorKey: rootNavigatorKey,
debugLogDiagnostics: true,
redirect: (context, state) {
redirect: (context, state) async {
// final isLoggedIn = ref.read(isUserAuthorizedProvider);

// if (!isLoggedIn) {
// return AppRoute.signIn.name;
// }

// final userData =
// await ref.read(userDataProvider.future).onError((error, stackTrace) {
// return null;
// });

// if (userData != null) {
// return AppRoute.home.name;
// } else {
// return AppRoute.signIn.name;
// }
return null;
},
routes: [
Expand Down Expand Up @@ -84,6 +100,26 @@ GoRouter goRouter(GoRouterRef ref) {
child: const RegisterPetPage(),
),
),
GoRoute(
path: AppRoute.sosPostDetail.path,
name: AppRoute.sosPostDetail.name,
pageBuilder: (context, state) {
final postEntity = state.extra as SosPostEntity?;
final postId = (postEntity != null)
? postEntity.postId
: int.parse(state.pathParameters['postId'] ?? '-1');

if (postId <= 0) {
print('올바른 sos postId가 아닙니다.');
}

return MaterialPage(
child: SosPostDetailView(
postId: postId,
sosPostEntity: postEntity,
),
);
}),
StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) =>
MainPage(navigationShell: navigationShell),
Expand All @@ -92,35 +128,13 @@ GoRouter goRouter(GoRouterRef ref) {
navigatorKey: _homeNavigatorKey,
routes: [
GoRoute(
path: AppRoute.home.path,
name: AppRoute.home.name,
pageBuilder: (context, state) => NoTransitionPage(
key: state.pageKey,
child: const HomeView(),
),
routes: [
GoRoute(
path: AppRoute.sosPostDetail.chileRoutePath,
name: AppRoute.sosPostDetail.name,
pageBuilder: (context, state) {
final postEntity = state.extra as SosPostEntity?;
final postId = (postEntity != null)
? postEntity.postId
: int.parse(
state.pathParameters['postId'] ?? '-1');

if (postId <= 0) {
print('올바른 sos postId가 아닙니다.');
}

return MaterialPage(
child: SosPostDetailView(
postId: postId,
sosPostEntity: postEntity,
),
);
})
]),
path: AppRoute.home.path,
name: AppRoute.home.name,
pageBuilder: (context, state) => NoTransitionPage(
key: state.pageKey,
child: const HomeView(),
),
),
],
),
StatefulShellBranch(
Expand Down
1 change: 1 addition & 0 deletions lib/core/constants/text_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ abstract class AppTextStyle {

static final TextStyle headlineRegular1 = pretendardRegularStyle(22, 29);
static final TextStyle headlineRegular2 = pretendardRegularStyle(20, 24);
static final TextStyle headlineRegular3 = pretendardRegularStyle(18, 30);

static final TextStyle bodyBold1 = pretendardSemiBoldStyle(16, 19);
static final TextStyle bodyBold2 = pretendardSemiBoldStyle(14, 17);
Expand Down
1 change: 1 addition & 0 deletions lib/presentation/main/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class _BottomNavigationBar extends ConsumerWidget {
child: Wrap(
children: [
BottomNavigationBar(
elevation: 0,
currentIndex: currentTab.index,
backgroundColor: Colors.white,
type: BottomNavigationBarType.fixed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,28 @@ class _SosPostDetailTabView extends HookConsumerWidget with HomeEvent {
children: [
gapH16,
_buildTabBarIndicator(tabController),
Expanded(
child: TabBarView(
controller: tabController,
children: [
_SosDetailConditionsTab(),
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
)
],
),
_buildTabView(tabController),
],
),
);
}

Expanded _buildTabView(TabController tabController) {
return Expanded(
child: TabBarView(
controller: tabController,
children: [
_SosDetailConditionsTab(),
Container(
color: Colors.red,
width: 100,
height: 100,
),
Container(
color: Colors.green,
width: 100,
height: 100,
)
],
),
);
Expand All @@ -51,6 +55,7 @@ class _SosPostDetailTabView extends HookConsumerWidget with HomeEvent {
padding: const EdgeInsets.only(left: 24),
alignment: Alignment.centerLeft,
child: TabBar(
tabAlignment: TabAlignment.start,
isScrollable: true,
controller: tabController,
labelPadding: const EdgeInsets.only(right: 16),
Expand Down Expand Up @@ -100,19 +105,28 @@ class _SosDetailConditionsTab extends StatelessWidget {
Wrap(
spacing: 20,
children: conditionBadgeList
.map((e) => Container(
height: 56,
width: 56,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.of.white,
boxShadow: [
BoxShadow(
offset: Offset(2, 3),
blurRadius: 9,
color:
AppColor.of.gray30.withOpacity(0.3))
]),
.map((e) => Column(
children: [
Container(
height: 56,
width: 56,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.of.white,
boxShadow: [
BoxShadow(
offset: Offset(2, 3),
blurRadius: 9,
color: AppColor.of.gray30
.withOpacity(0.3))
]),
),
gapH12,
Text(
'condition',
style: AppTextStyle.bodyRegular3,
),
],
))
.toList(),
)
Expand All @@ -125,29 +139,56 @@ class _SosDetailConditionsTab extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('data'),
Text('data'),
Text(
'data',
style: AppTextStyle.headlineMedium2,
),
Text(
'data',
style: AppTextStyle.headlineRegular3,
),
],
),
gapH8,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('data'),
Text('data'),
Text(
'data',
style: AppTextStyle.headlineMedium2,
),
Text(
'data',
style: AppTextStyle.headlineRegular3,
),
],
),
gapH8,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('data'),
Text('data'),
Text(
'data',
style: AppTextStyle.headlineMedium2,
),
Text(
'data',
style: AppTextStyle.headlineRegular3,
),
],
),
gapH8,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('data'),
Text('data'),
Text(
'data',
style: AppTextStyle.headlineMedium2,
),
Text(
'data',
style: AppTextStyle.headlineRegular3,
),
],
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SosPostDetailView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 24),
child: ActivationButton(
text: '채팅하기',
buttonColor: AppColor.of.primaryGreen,
isActive: true,
onTap: () {},
),
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/pages/sos/list/sos_post_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mixin class SosPostViewEvent implements _SosPostViewEvent {
ref.context.pushNamed(
AppRoute.sosPostDetail.name,
extra: sosPost,
pathParameters: {
queryParameters: {
'postId': sosPost.postId.toString(),
},
);
Expand Down
12 changes: 9 additions & 3 deletions lib/presentation/widgets/button/activation_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class ActivationButton extends StatelessWidget {
const ActivationButton({
required this.text,
required this.isActive,
this.textColor,
this.buttonColor,
this.onTap,
super.key,
});
Expand All @@ -14,6 +16,10 @@ class ActivationButton extends StatelessWidget {

final String text;

final Color? textColor;

final Color? buttonColor;

@override
Widget build(BuildContext context) {
return GestureDetector(
Expand All @@ -22,15 +28,15 @@ class ActivationButton extends StatelessWidget {
alignment: Alignment.center,
margin: const EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
color: isActive ? Colors.black : Color(0xffD1D1D1),
color: isActive ? buttonColor ?? Colors.black : Color(0xffD1D1D1),
borderRadius: BorderRadius.circular(4)),
width: double.infinity,
height: 50,
child: Text(
text,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: textColor ?? Colors.white,
fontSize: 17,
),
),
Expand Down

0 comments on commit 9bc9110

Please sign in to comment.