Skip to content

Commit

Permalink
fix:바텀네비게이션바 높이 조정 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
nain93 authored Aug 5, 2023
1 parent 60761ed commit 43f6945
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 158 deletions.
13 changes: 6 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand All @@ -16,7 +15,6 @@ import 'package:moa_app/utils/config.dart';
import 'package:moa_app/utils/custom_scaffold.dart';
import 'package:moa_app/utils/router_provider.dart';
import 'package:moa_app/utils/themes.dart';
import 'package:moa_app/utils/tools.dart';

class Logger extends ProviderObserver {
@override
Expand All @@ -37,10 +35,10 @@ class Logger extends ProviderObserver {
}
}

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp();
logger.d('Handling a background message: ${message.messageId}');
}
// Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
// await Firebase.initializeApp();
// logger.d('Handling a background message: ${message.messageId}');
// }

void main() async {
usePathUrlStrategy();
Expand All @@ -52,7 +50,7 @@ void main() async {
options: DefaultFirebaseOptions.currentPlatform,
);

FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
// FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

// KaKao login setup
KakaoSdk.init(
Expand Down Expand Up @@ -90,6 +88,7 @@ class MyApp extends HookConsumerWidget {
darkTheme: Themes.dark,
themeMode: ThemeMode.light,
routerConfig: ref.watch(routeProvider),
// 웹에서 scaffold를 사용할 때 최대 너비를 제한하기 위해 사용
builder: (context, child) {
return CustomScaffold.responsive(
builder: (context, x, y) {
Expand Down
4 changes: 4 additions & 0 deletions lib/navigations/main_bottom_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class MainBottomTab extends HookConsumerWidget {
}

return Scaffold(
resizeToAvoidBottomInset: false,
body: child,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling,
Expand Down Expand Up @@ -171,6 +172,9 @@ class MainBottomTab extends HookConsumerWidget {
],
),
child: BottomAppBar(
height: MediaQuery.of(context).viewInsets.bottom > 0
? 0
: const BottomAppBar().height,
shape: const CircularNotchedRectangle(),
notchMargin: 5,
padding: EdgeInsets.only(
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Home extends HookConsumerWidget {
tabIdx.value = 1;
}
});
return () => tabController.dispose();
return () {};
}, []);

return Container(
Expand Down
2 changes: 0 additions & 2 deletions lib/screens/home/tab_view/folder_tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ class FolderTabView extends HookConsumerWidget {
{required String folderName, required Color folderColor}) {
General.instance.showBottomSheet(
context: context,
padding:
const EdgeInsets.only(left: 15, right: 15, top: 15, bottom: 30),
height: 225,
child: Column(
children: [
Expand Down
5 changes: 4 additions & 1 deletion lib/utils/custom_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class CustomScaffold extends StatelessWidget {
}

static Scaffold _buildSafeScaffold({required Widget child}) {
return Scaffold(body: child);
return Scaffold(
resizeToAvoidBottomInset: false,
body: child,
);
}

@override
Expand Down
27 changes: 23 additions & 4 deletions lib/utils/general.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ class General {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (_) => isContainer
isScrollControlled: true,
builder: (context) => isContainer
? Container(
height: height,
padding: padding ??
const EdgeInsets.symmetric(horizontal: 25, vertical: 20),
padding: EdgeInsets.only(
left: 15,
right: 15,
top: 20,
bottom: MediaQuery.of(context).viewInsets.bottom),
decoration: const BoxDecoration(
color: AppColors.whiteColor,
borderRadius: BorderRadius.only(
Expand Down Expand Up @@ -55,7 +59,22 @@ class General {
)
: child,
)
: child,
: Container(
padding: EdgeInsets.only(
left: 15,
right: 15,
top: 50,
bottom: MediaQuery.of(context).viewInsets.bottom,
),
decoration: const BoxDecoration(
color: AppColors.whiteColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
child: child,
),
// isDismissible: false,
enableDrag: false,
);
Expand Down
130 changes: 59 additions & 71 deletions lib/widgets/moa_widgets/add_folder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,82 +69,70 @@ class AddFolder extends HookConsumerWidget {
emptyFolderName();
}

return Container(
decoration: const BoxDecoration(
color: AppColors.whiteColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
child: Stack(children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 25),
child: Form(
key: formKey,
child: Column(
children: [
const Center(
child: Text('폴더 추가', style: H2TextStyle()),
),
const SizedBox(height: 30),
EditFormText(
maxLength: 7,
controller: folderNameController,
onChanged: folderOnChangedValue,
hintText: '폴더명을 입력하세요.',
backgroundColor: AppColors.textInputBackground,
suffixIcon: CircleIconButton(
icon: Image(
fit: BoxFit.contain,
image: Assets.circleClose,
width: 16,
height: 16,
),
onPressed: emptyFolderName,
),
),
const SizedBox(height: 5),
Row(
children: [
const Spacer(),
Text(
'${folderNameController.text.length}/7',
style: TextStyle(
color: folderNameController.text.length == 7
? AppColors.danger
: AppColors.blackColor.withOpacity(0.3),
fontSize: 12,
fontFamily: FontConstants.pretendard),
),
],
return Stack(children: [
Form(
key: formKey,
child: Column(
children: [
const Center(
child: Text('폴더 추가', style: H2TextStyle()),
),
const SizedBox(height: 30),
EditFormText(
maxLength: 7,
controller: folderNameController,
onChanged: folderOnChangedValue,
hintText: '폴더명을 입력하세요.',
backgroundColor: AppColors.textInputBackground,
suffixIcon: CircleIconButton(
icon: Image(
fit: BoxFit.contain,
image: Assets.circleClose,
width: 16,
height: 16,
),
onPressed: emptyFolderName,
),
),
const SizedBox(height: 5),
Row(
children: [
const Spacer(),
Button(
loading: loading.value,
disabled: folderNameController.text.isEmpty,
margin: const EdgeInsets.only(bottom: 30),
text: '추가하기',
onPress: addFolder,
)
Text(
'${folderNameController.text.length}/7',
style: TextStyle(
color: folderNameController.text.length == 7
? AppColors.danger
: AppColors.blackColor.withOpacity(0.3),
fontSize: 12,
fontFamily: FontConstants.pretendard),
),
],
),
),
const Spacer(),
Button(
loading: loading.value,
disabled: folderNameController.text.isEmpty,
margin: const EdgeInsets.only(bottom: 30),
text: '추가하기',
onPress: addFolder,
)
],
),
Positioned(
right: 0,
top: 12,
child: CircleIconButton(
backgroundColor: Colors.white,
onPressed: closeBottomSheet,
icon: const Icon(
Icons.close,
color: AppColors.blackColor,
size: 30,
),
),
Positioned(
right: -15,
top: -15,
child: CircleIconButton(
backgroundColor: Colors.white,
onPressed: closeBottomSheet,
icon: const Icon(
Icons.close,
color: AppColors.blackColor,
size: 30,
),
)
]),
);
),
)
]);
}
}
Loading

0 comments on commit 43f6945

Please sign in to comment.