-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from team-balt/feature/sleeping
Create Out Sleeping Screen
- Loading branch information
Showing
31 changed files
with
1,602 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class SettingList extends StatelessWidget { | ||
final String title; | ||
final String trailing; | ||
|
||
const SettingList({ | ||
Key? key, | ||
required this.title, | ||
required this.trailing, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), | ||
decoration: BoxDecoration( | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(12.0), | ||
boxShadow: [ | ||
BoxShadow( | ||
color: Colors.black.withOpacity(0.1), | ||
offset: const Offset(0, 4), | ||
blurRadius: 8, | ||
), | ||
], | ||
), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text( | ||
title, | ||
style: const TextStyle( | ||
fontSize: 16, | ||
color: Colors.black, | ||
), | ||
), | ||
Text( | ||
trailing, | ||
style: const TextStyle( | ||
fontSize: 16, | ||
color: Colors.black54, | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
import '../../component/appbar.dart'; | ||
import '../../component/theme/color.dart'; | ||
import '../../component/bottom_navigation_bar.dart'; | ||
import '../../feature/login/login_navigation.dart'; | ||
import '../../feature/night_study/night_study_navigation.dart'; | ||
import '../../feature/out/out_navigation.dart'; | ||
import '../../feature/out_sleeping/out_sleeping_navigation.dart'; | ||
import '../logout/logout_viewmodel.dart'; | ||
import 'item/setting_item.dart'; | ||
|
||
class SettingScreen extends StatefulWidget { | ||
const SettingScreen({super.key}); | ||
|
||
@override | ||
State<SettingScreen> createState() => _SettingScreenState(); | ||
} | ||
|
||
class _SettingScreenState extends State<SettingScreen> { | ||
int _selectedIndex = 2; | ||
|
||
void _onItemTapped(int index) { | ||
setState(() { | ||
_selectedIndex = index; | ||
|
||
switch (index) { | ||
case 0: | ||
Navigator.pushReplacementNamed(context, outSleepingRoute); | ||
break; | ||
case 1: | ||
Navigator.pushReplacementNamed(context, outRoute); | ||
break; | ||
case 2: | ||
break; | ||
case 3: | ||
Navigator.pushReplacementNamed(context, nightStudyRoute); | ||
break; | ||
} | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final viewModel = Provider.of<SettingViewModel>(context); | ||
|
||
return Scaffold( | ||
appBar: PreferredSize( | ||
preferredSize: const Size.fromHeight(60), | ||
child: EasierDodamDefaultAppbar( | ||
title: "설정", | ||
colors: EasierDodamColors.staticWhite, | ||
onPlusClick: () {}, | ||
), | ||
), | ||
body: Column( | ||
children: [ | ||
Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.all(16), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
SettingList( | ||
title: '앱 버전', | ||
trailing: 'v1.00', | ||
), | ||
const SizedBox(height: 24), | ||
Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(12.0), | ||
boxShadow: [ | ||
BoxShadow( | ||
color: Colors.black.withOpacity(0.1), | ||
offset: const Offset(0, 4), | ||
blurRadius: 8, | ||
), | ||
], | ||
), | ||
child: SizedBox( | ||
width: double.infinity, | ||
height: 56.0, | ||
child: ElevatedButton( | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: EasierDodamColors.primary300, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(12.0), | ||
), | ||
), | ||
onPressed: () async { | ||
final success = await viewModel.logout(); | ||
if (success) { | ||
Navigator.pushReplacementNamed(context, loginRoute); | ||
} | ||
}, | ||
child: const Text( | ||
'로그아웃', | ||
style: TextStyle( | ||
color: EasierDodamColors.staticWhite, | ||
fontSize: 16, | ||
fontWeight: FontWeight.w600, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
], | ||
), | ||
bottomNavigationBar: EasierDodamBottomNavigationBar( | ||
selectedIndex: _selectedIndex, | ||
onItemTapped: _onItemTapped, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const logoutRoute = "logout"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
import '../../local/storage_manager.dart'; | ||
|
||
class SettingViewModel with ChangeNotifier { | ||
Future<bool> logout() async { | ||
await StorageManager.deleteUserAccount(); | ||
notifyListeners(); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.