종료 페이지 완료, 애드몹 전부 적용 완료, 설문조사 시작

This commit is contained in:
eld_master 2025-01-17 17:47:15 +09:00
parent f416094820
commit a8445b70ed
11 changed files with 316 additions and 250 deletions

View File

@ -17,7 +17,16 @@ class RoomSettingFinishDialog extends StatelessWidget {
final String openYn = (roomInfo['open_yn'] ?? 'Y') as String; final String openYn = (roomInfo['open_yn'] ?? 'Y') as String;
final int maxPeople = (roomInfo['number_of_people'] ?? 0) as int; final int maxPeople = (roomInfo['number_of_people'] ?? 0) as int;
final int runningTime = (roomInfo['running_time'] ?? 0) as int; final int runningTime = (roomInfo['running_time'] ?? 0) as int;
final String scoreOpen = (roomInfo['score_open_range'] ?? 'ALL') as String; final String tempScoreOpen = (roomInfo['score_open_range'] ?? 'ALL') as String;
var scoreOpen = '';
if (tempScoreOpen == 'ALL' || tempScoreOpen == 'all') {
scoreOpen = '전체 공개';
} else if (tempScoreOpen == 'TEAM' || tempScoreOpen == 'team') {
scoreOpen = '팀 공개';
} else {
scoreOpen = '개인 공개';
}
final String openLabel = (openYn == 'Y') ? '공개' : '비공개'; final String openLabel = (openYn == 'Y') ? '공개' : '비공개';

View File

@ -0,0 +1,111 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
// :
// SurveyPage를 .
class SurveyPage extends StatelessWidget {
const SurveyPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('임시 설문 페이지'),
backgroundColor: Colors.black,
),
body: const Center(
child: Text('여기는 설문 페이지입니다 (임시).'),
),
);
}
}
/// ()
Future<void> showSurveyDialog(BuildContext context) async {
showDialog(
context: context,
barrierDismissible: false, //
builder: (_) => const SurveyDialog(),
);
}
/// AlertDialog
class SurveyDialog extends StatefulWidget {
const SurveyDialog({Key? key}) : super(key: key);
@override
State<SurveyDialog> createState() => _SurveyDialogState();
}
class _SurveyDialogState extends State<SurveyDialog> {
bool _todayNotSee = false; // "오늘 하루 보지 않기"
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('설문 참여 안내'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'안녕하세요, "올스코어" 앱을 이용해주셔서 감사합니다.\n\n'
'더 나은 서비스 제공을 위해 간단한 설문조사를 준비했습니다.\n'
'설문조사에 참여해주시면 앱 발전에 큰 도움이 됩니다!\n'
'(약 1분 소요)',
),
const SizedBox(height: 16),
// "오늘 하루 보지 않기"
Row(
children: [
Checkbox(
value: _todayNotSee,
onChanged: (val) {
setState(() {
_todayNotSee = val ?? false;
});
},
),
const Text('오늘 하루 보지 않기'),
],
),
],
),
),
actions: [
// "닫기"
TextButton(
onPressed: () async {
// , SharedPreferences
if (_todayNotSee) {
final prefs = await SharedPreferences.getInstance();
// : survey_popup_today = 'Y'
await prefs.setString('survey_popup_today', 'Y');
}
Navigator.pop(context); //
},
style: TextButton.styleFrom(backgroundColor: Colors.grey),
child: const Text('닫기', style: TextStyle(color: Colors.white)),
),
// "설문 참여"
TextButton(
onPressed: () async {
// , SharedPreferences
if (_todayNotSee) {
final prefs = await SharedPreferences.getInstance();
await prefs.setString('survey_popup_today', 'Y');
}
Navigator.pop(context); //
//
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const SurveyPage()),
);
},
style: TextButton.styleFrom(backgroundColor: Colors.black),
child: const Text('설문 참여', style: TextStyle(color: Colors.white)),
),
],
);
}
}

View File

@ -6,14 +6,16 @@ import '../../dialogs/response_dialog.dart';
import '../../dialogs/room_setting_finish_dialog.dart'; import '../../dialogs/room_setting_finish_dialog.dart';
import '../../dialogs/user_info_finish_dialog.dart'; import '../../dialogs/user_info_finish_dialog.dart';
import 'main_page.dart';
class FinishPrivatePage extends StatefulWidget { class FinishPrivatePage extends StatefulWidget {
final int roomSeq; final int roomSeq;
final bool fromPlayingPage; // / => final String enterType; // / =>
const FinishPrivatePage({ const FinishPrivatePage({
Key? key, Key? key,
required this.roomSeq, required this.roomSeq,
this.fromPlayingPage = false, required this.enterType,
}) : super(key: key); }) : super(key: key);
@override @override
@ -28,10 +30,8 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
// userSeq { user_seq, nickname, participant_type, score, ... } // userSeq { user_seq, nickname, participant_type, score, ... }
Map<String, dynamic> _userMap = {}; Map<String, dynamic> _userMap = {};
// ( ) ( ) // ( )
List<Map<String, dynamic>> _playerList = []; List<Map<String, dynamic>> _playerList = [];
// (ADMIN) ( 1 )
List<Map<String, dynamic>> _adminList = [];
String _roomTitle = ''; String _roomTitle = '';
DateTime? _startDt; DateTime? _startDt;
@ -87,17 +87,7 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
tempList.add(Map<String, dynamic>.from(val)); tempList.add(Map<String, dynamic>.from(val));
}); });
// (1) (ADMIN) final playerList = tempList.toList();
final adminList = tempList.where((u) {
final pType = (u['participant_type'] ?? '').toString().toUpperCase();
return pType == 'ADMIN';
}).toList();
// (2) (ADMIN ) &
final playerList = tempList.where((u) {
final pType = (u['participant_type'] ?? '').toString().toUpperCase();
return pType != 'ADMIN';
}).toList();
// //
playerList.sort((a, b) { playerList.sort((a, b) {
@ -107,7 +97,6 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
}); });
setState(() { setState(() {
_adminList = adminList;
_playerList = playerList; _playerList = playerList;
_isLoading = false; _isLoading = false;
}); });
@ -128,9 +117,9 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
/// (B) /// (B)
Future<bool> _onWillPop() async { Future<bool> _onWillPop() async {
if (widget.fromPlayingPage) { if (widget.enterType == 'game') {
// / => // =>
Navigator.popUntil(context, (route) => route.isFirst); Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (_) => const MainPage()), (route) => false);
} else { } else {
// => pop // => pop
Navigator.pop(context); Navigator.pop(context);
@ -163,9 +152,18 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
/// - 1/2/3 // /// - 1/2/3 //
Widget _buildPlayerItem(Map<String, dynamic> user, int index) { Widget _buildPlayerItem(Map<String, dynamic> user, int index) {
final score = (user['score'] ?? 0) as int; final score = (user['score'] ?? 0) as int;
final nickname = user['nickname'] ?? '유저'; var nickname = user['nickname'] ?? '유저';
final profileImg = user['profile_img'] ?? ''; final profileImg = user['profile_img'] ?? '';
final userSeq = user['user_seq'] ?? 0; final userSeq = user['user_seq'] ?? 0;
final participantType = user['participant_type'] ?? '';
if (_masterUserSeq == userSeq) {
//
nickname = '' + nickname;
} else if (participantType == 'ADMIN') {
//
nickname = '' + nickname;
}
Widget medal = const SizedBox(); Widget medal = const SizedBox();
if (index == 0) { if (index == 0) {
@ -211,37 +209,6 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
); );
} }
/// ( 1 )
Widget _buildAdminItem(Map<String, dynamic> admin) {
final nickname = admin['nickname'] ?? '사회자';
final profileImg = admin['profile_img'] ?? '';
return GestureDetector(
onTap: () => _onTapUser(admin),
child: Row(
children: [
Container(
width: 36, height: 36,
margin: const EdgeInsets.only(right: 8),
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: Colors.deepPurple),
),
child: ClipOval(
child: (profileImg.isNotEmpty)
? Image.network(
'https://eldsoft.com:8097/images$profileImg',
fit: BoxFit.cover,
errorBuilder: (_, __, ___) => const Center(child: Text('ERR')),
)
: const Center(child: Text('No\nImg', textAlign: TextAlign.center, style: TextStyle(fontSize: 10))),
),
),
Text(nickname, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.deepPurple)),
],
),
);
}
/// -> /// ->
Future<void> _onTapUser(Map<String, dynamic> userData) async { Future<void> _onTapUser(Map<String, dynamic> userData) async {
// user_info_finish_dialog.dart ( ) // user_info_finish_dialog.dart ( )
@ -290,25 +257,6 @@ class _FinishPrivatePageState extends State<FinishPrivatePage> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
// (B)
if (_adminList.isNotEmpty) ...[
Container(
width: double.infinity,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
border: Border.all(color: Colors.deepPurple),
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
const Text('사회자: ', style: TextStyle(fontSize: 14, color: Colors.deepPurple)),
..._adminList.map(_buildAdminItem),
],
),
),
const SizedBox(height: 16),
],
// (C) // (C)
ListView.builder( ListView.builder(
primary: false, primary: false,

View File

@ -6,14 +6,16 @@ import '../../dialogs/response_dialog.dart';
import '../../dialogs/room_setting_finish_dialog.dart'; import '../../dialogs/room_setting_finish_dialog.dart';
import '../../dialogs/user_info_finish_dialog.dart'; import '../../dialogs/user_info_finish_dialog.dart';
import 'main_page.dart';
class FinishTeamPage extends StatefulWidget { class FinishTeamPage extends StatefulWidget {
final int roomSeq; final int roomSeq;
final bool fromPlayingPage; // final String enterType; // / =>
const FinishTeamPage({ const FinishTeamPage({
Key? key, Key? key,
required this.roomSeq, required this.roomSeq,
this.fromPlayingPage = false, required this.enterType,
}) : super(key: key); }) : super(key: key);
@override @override
@ -37,8 +39,6 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
// //
Map<String, int> _teamScoreMap = {}; Map<String, int> _teamScoreMap = {};
//
List<Map<String, dynamic>> _adminList = [];
@override @override
void initState() { void initState() {
@ -86,17 +86,8 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
tempList.add(Map<String, dynamic>.from(val)); tempList.add(Map<String, dynamic>.from(val));
}); });
// (1) (ADMIN)
final adminList = tempList.where((u) {
final pType = (u['participant_type'] ?? '').toString().toUpperCase();
return pType == 'ADMIN';
}).toList();
// (2) final players = tempList.toList();
final players = tempList.where((u) {
final pType = (u['participant_type'] ?? '').toString().toUpperCase();
return pType != 'ADMIN';
}).toList();
// (3) + // (3) +
final Map<String, List<Map<String, dynamic>>> tMap = {}; final Map<String, List<Map<String, dynamic>>> tMap = {};
@ -138,7 +129,6 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
} }
setState(() { setState(() {
_adminList = adminList;
_userList = tempList; // _userList = tempList; //
_teamMap = finalTeamMap; _teamMap = finalTeamMap;
_teamScoreMap = finalScoreMap; _teamScoreMap = finalScoreMap;
@ -160,8 +150,8 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
} }
Future<bool> _onWillPop() async { Future<bool> _onWillPop() async {
if (widget.fromPlayingPage) { if (widget.enterType == 'game') {
Navigator.popUntil(context, (route) => route.isFirst); Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (_) => const MainPage()), (route) => false);
} else { } else {
Navigator.pop(context); Navigator.pop(context);
} }
@ -241,8 +231,18 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
/// ///
Widget _buildTeamMember(Map<String, dynamic> user) { Widget _buildTeamMember(Map<String, dynamic> user) {
final score = (user['score'] ?? 0) as int; final score = (user['score'] ?? 0) as int;
final nickname = user['nickname'] ?? '유저'; var nickname = user['nickname'] ?? '유저';
final profileImg = user['profile_img'] ?? ''; final profileImg = user['profile_img'] ?? '';
final userSeq = user['user_seq'] ?? 0;
final participantType = user['participant_type'] ?? '';
if (_masterUserSeq == userSeq) {
//
nickname = '' + nickname;
} else if (participantType == 'ADMIN') {
//
nickname = '' + nickname;
}
return GestureDetector( return GestureDetector(
onTap: () => _onTapUser(user), onTap: () => _onTapUser(user),
@ -278,63 +278,6 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
); );
} }
/// (ADMIN)
Widget _buildAdminList() {
final adminList = _adminList;
if (adminList.isEmpty) return const SizedBox();
return Container(
width: double.infinity,
margin: const EdgeInsets.only(top: 16),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.deepPurple),
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Container(
color: Colors.black,
width: double.infinity,
padding: const EdgeInsets.all(8),
child: const Center(
child: Text('사회자', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
),
),
ListView.builder(
shrinkWrap: true,
primary: false,
itemCount: adminList.length,
itemBuilder: (ctx, i) {
final user = adminList[i];
return _buildAdminItem(user);
},
),
],
),
);
}
Widget _buildAdminItem(Map<String, dynamic> user) {
final nickname = user['nickname'] ?? '사회자';
final profileImg = user['profile_img'] ?? '';
return ListTile(
onTap: () => _onTapUser(user),
leading: CircleAvatar(
backgroundColor: Colors.white,
backgroundImage: (profileImg.isNotEmpty)
? NetworkImage('https://eldsoft.com:8097/images$profileImg')
: null,
child: (profileImg.isEmpty)
? const Text('NoImg', style: TextStyle(fontSize: 10))
: null,
),
title: Text(nickname),
subtitle: const Text('사회자'),
);
}
Future<void> _onTapUser(Map<String, dynamic> userData) async { Future<void> _onTapUser(Map<String, dynamic> userData) async {
// //
await showDialog( await showDialog(
@ -388,8 +331,6 @@ class _FinishTeamPageState extends State<FinishTeamPage> {
for (int i = 0; i < teamNames.length; i++) for (int i = 0; i < teamNames.length; i++)
_buildTeamBox(teamNames[i], i), _buildTeamBox(teamNames[i], i),
//
_buildAdminList(),
], ],
), ),
), ),

View File

@ -22,6 +22,9 @@ import 'package:fluttertoast/fluttertoast.dart'; // 뒤로가기 안내 문구
// //
import '../../config/config.dart'; import '../../config/config.dart';
//
import '../../dialogs/survey_dialog.dart';
class MainPage extends StatefulWidget { class MainPage extends StatefulWidget {
const MainPage({Key? key}) : super(key: key); const MainPage({Key? key}) : super(key: key);
@ -55,6 +58,9 @@ class _MainPageState extends State<MainPage> {
// (C) // (C)
_initBannerAd(); _initBannerAd();
// (D)
_checkSurveyPopup();
} }
@override @override
@ -86,6 +92,18 @@ class _MainPageState extends State<MainPage> {
_bannerAd?.load(); _bannerAd?.load();
} }
/// "오늘 하루 보지 않기" ,
Future<void> _checkSurveyPopup() async {
final prefs = await SharedPreferences.getInstance();
final shownToday = prefs.getString('survey_popup_today') ?? 'N';
if (shownToday == 'N') {
//
Future.delayed(Duration.zero, () {
showSurveyDialog(context);
});
}
}
Future<bool> _onWillPop() async { Future<bool> _onWillPop() async {
final now = DateTime.now(); final now = DateTime.now();
if (_lastPressedTime == null || if (_lastPressedTime == null ||

View File

@ -143,7 +143,7 @@ class _PlayingPrivatePageState extends State<PlayingPrivatePage> {
if (mounted) { if (mounted) {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute(builder: (_) => FinishPrivatePage(roomSeq: widget.roomSeq)), MaterialPageRoute(builder: (_) => FinishPrivatePage(roomSeq: widget.roomSeq, enterType: 'game')),
(route) => false, (route) => false,
); );
} }
@ -175,9 +175,12 @@ class _PlayingPrivatePageState extends State<PlayingPrivatePage> {
final List<Map<String, dynamic>> rawList = []; final List<Map<String, dynamic>> rawList = [];
userInfoData.forEach((uSeq, uData) { userInfoData.forEach((uSeq, uData) {
// //
if (uSeq.toString() == roomInfoData['master_user_seq'].toString()) uData['nickname'] = '' + (uData['nickname'] ?? '유저'); if (uSeq.toString() == roomInfoData['master_user_seq'].toString()) {
uData['nickname'] = '' + (uData['nickname'] ?? '유저');
} else if ((uData['participant_type'] ?? '').toString().toUpperCase() == 'ADMIN') {
// //
if ((uData['participant_type'] ?? '').toString().toUpperCase() == 'ADMIN') uData['nickname'] = '' + (uData['nickname'] ?? '유저'); uData['nickname'] = '' + (uData['nickname'] ?? '유저');
}
rawList.add({ rawList.add({
'user_seq': uSeq, 'user_seq': uSeq,
'participant_type': (uData['participant_type'] ?? '').toString().toUpperCase(), 'participant_type': (uData['participant_type'] ?? '').toString().toUpperCase(),
@ -222,6 +225,7 @@ class _PlayingPrivatePageState extends State<PlayingPrivatePage> {
MaterialPageRoute( MaterialPageRoute(
builder: (_) => FinishPrivatePage( builder: (_) => FinishPrivatePage(
roomSeq: widget.roomSeq, roomSeq: widget.roomSeq,
enterType: 'game',
), ),
), ),
(route) => false, (route) => false,

View File

@ -146,7 +146,7 @@ class _PlayingTeamPageState extends State<PlayingTeamPage> {
if (mounted) { if (mounted) {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute(builder: (_) => FinishTeamPage(roomSeq: widget.roomSeq)), MaterialPageRoute(builder: (_) => FinishTeamPage(roomSeq: widget.roomSeq, enterType: 'game')),
(route) => false, (route) => false,
); );
} }
@ -253,6 +253,7 @@ class _PlayingTeamPageState extends State<PlayingTeamPage> {
MaterialPageRoute( MaterialPageRoute(
builder: (_) => FinishTeamPage( builder: (_) => FinishTeamPage(
roomSeq: widget.roomSeq, roomSeq: widget.roomSeq,
enterType: 'game',
), ),
), ),
(route) => false, (route) => false,

View File

@ -1,12 +1,61 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'room_search_list_page.dart'; import 'room_search_list_page.dart';
/// //
/// - "대기중/진행중/종료" 3 import '../../config/config.dart';
/// - RoomSearchListPage로 +
class RoomSearchHomePage extends StatelessWidget { //
import 'package:google_mobile_ads/google_mobile_ads.dart'; // AdMob
class RoomSearchHomePage extends StatefulWidget {
const RoomSearchHomePage({Key? key}) : super(key: key); const RoomSearchHomePage({Key? key}) : super(key: key);
@override
State<RoomSearchHomePage> createState() => _RoomSearchHomePageState();
}
class _RoomSearchHomePageState extends State<RoomSearchHomePage> {
BannerAd? _bannerAd;
bool _isBannerReady = false; //
String adUnitId = Config.testAdUnitId;
@override
void initState() {
super.initState();
// (C)
_initBannerAd();
}
@override
void dispose() {
_bannerAd?.dispose();
super.dispose();
}
///
void _initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner, //
// adUnitId: 'ca-app-pub-3940256099942544/6300978111' ()
adUnitId: adUnitId, // / ID
listener: BannerAdListener(
onAdLoaded: (Ad ad) {
setState(() => _isBannerReady = true);
debugPrint('배너 광고 로드 완료');
},
onAdFailedToLoad: (Ad ad, LoadAdError err) {
debugPrint('배너 광고 로드 실패: $err');
ad.dispose();
},
),
request: const AdRequest(),
);
// load()
_bannerAd?.load();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -23,13 +72,14 @@ class RoomSearchHomePage extends StatelessWidget {
), ),
// //
bottomNavigationBar: Container( bottomNavigationBar: _isBannerReady && _bannerAd != null
height: 50, ? Container(
color: Colors.grey.shade400, color: Colors.white,
child: const Center( width: _bannerAd!.size.width.toDouble(),
child: Text('구글 광고', style: TextStyle(color: Colors.black)), height: _bannerAd!.size.height.toDouble(),
), child: AdWidget(ad: _bannerAd!),
), )
: SizedBox.shrink(), // or
// : 3 ( / / ) // : 3 ( / / )
body: Center( body: Center(

View File

@ -10,6 +10,12 @@ import '../../dialogs/room_detail_dialog.dart';
import '../room/finish_private_page.dart'; import '../room/finish_private_page.dart';
import '../room/finish_team_page.dart'; import '../room/finish_team_page.dart';
//
import '../../config/config.dart';
//
import 'package:google_mobile_ads/google_mobile_ads.dart'; // AdMob
class RoomSearchListPage extends StatefulWidget { class RoomSearchListPage extends StatefulWidget {
final String roomStatus; // WAIT / RUNNING / FINISH final String roomStatus; // WAIT / RUNNING / FINISH
@ -31,12 +37,20 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
late ScrollController _scrollController; late ScrollController _scrollController;
//
BannerAd? _bannerAd;
bool _isBannerReady = false; //
String adUnitId = Config.testAdUnitId;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_scrollController = ScrollController()..addListener(_onScroll); _scrollController = ScrollController()..addListener(_onScroll);
_fetchRoomList(isRefresh: true); _fetchRoomList(isRefresh: true);
// (C)
_initBannerAd();
} }
@override @override
@ -44,9 +58,33 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
_scrollController.removeListener(_onScroll); _scrollController.removeListener(_onScroll);
_scrollController.dispose(); _scrollController.dispose();
_searchController.dispose(); _searchController.dispose();
_bannerAd?.dispose();
super.dispose(); super.dispose();
} }
///
void _initBannerAd() {
_bannerAd = BannerAd(
size: AdSize.banner, //
// adUnitId: 'ca-app-pub-3940256099942544/6300978111' ()
adUnitId: adUnitId, // / ID
listener: BannerAdListener(
onAdLoaded: (Ad ad) {
setState(() => _isBannerReady = true);
debugPrint('배너 광고 로드 완료');
},
onAdFailedToLoad: (Ad ad, LoadAdError err) {
debugPrint('배너 광고 로드 실패: $err');
ad.dispose();
},
),
request: const AdRequest(),
);
// load()
_bannerAd?.load();
}
void _onScroll() { void _onScroll() {
if (!_scrollController.hasClients) return; if (!_scrollController.hasClients) return;
final thresholdPixels = 200; final thresholdPixels = 200;
@ -161,7 +199,7 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
MaterialPageRoute( MaterialPageRoute(
builder: (_) => FinishPrivatePage( builder: (_) => FinishPrivatePage(
roomSeq: roomSeq, roomSeq: roomSeq,
fromPlayingPage: false, // false enterType: 'search',
), ),
), ),
); );
@ -171,7 +209,7 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
MaterialPageRoute( MaterialPageRoute(
builder: (_) => FinishTeamPage( builder: (_) => FinishTeamPage(
roomSeq: roomSeq, roomSeq: roomSeq,
fromPlayingPage: false, enterType: 'search',
), ),
), ),
); );
@ -199,6 +237,15 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
), ),
), ),
//
bottomNavigationBar: _isBannerReady && _bannerAd != null
? Container(
color: Colors.white,
width: _bannerAd!.size.width.toDouble(),
height: _bannerAd!.size.height.toDouble(),
child: AdWidget(ad: _bannerAd!),
)
: SizedBox.shrink(), // or
body: Column( body: Column(
children: [ children: [
// //
@ -232,21 +279,6 @@ class _RoomSearchListPageState extends State<RoomSearchListPage> {
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: _buildRoomListView(), : _buildRoomListView(),
), ),
Container(
height: 60,
color: Colors.white,
child: Center(
child: Container(
height: 50,
width: 300,
color: Colors.grey.shade400,
child: const Center(
child: Text('구글 광고', style: TextStyle(color: Colors.black)),
),
),
),
),
], ],
), ),
); );

View File

@ -333,7 +333,7 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
} }
/// ///
Future<void> _onLeaveRoom() async { Future<bool> _onLeaveRoom() async {
if (roomMasterYn == 'Y') { if (roomMasterYn == 'Y') {
// //
final confirm = await showDialog<bool>( final confirm = await showDialog<bool>(
@ -378,7 +378,7 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
); );
}, },
); );
if (confirm != true) return; if (confirm != true) return false;
// leave API // leave API
setState(() {_roomExitYn = 'Y';}); setState(() {_roomExitYn = 'Y';});
@ -388,6 +388,7 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
setState(() {_roomExitYn = 'Y';}); setState(() {_roomExitYn = 'Y';});
await _requestLeaveRoom(); await _requestLeaveRoom();
} }
return false;
} }
int _toInt(dynamic val, int defaultVal) { int _toInt(dynamic val, int defaultVal) {
@ -557,7 +558,9 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
// (: 60:00 ~ 0:00) // (: 60:00 ~ 0:00)
final countdownStr = _formatDuration(_remaining); final countdownStr = _formatDuration(_remaining);
return Scaffold( return WillPopScope(
onWillPop: () => _onLeaveRoom(),
child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.black, backgroundColor: Colors.black,
@ -580,7 +583,7 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
), ),
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: Colors.white), icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: _onLeaveRoom, onPressed: () => _onLeaveRoom(),
), ),
), ),
bottomNavigationBar: _isBannerReady && _bannerAd != null bottomNavigationBar: _isBannerReady && _bannerAd != null
@ -602,43 +605,16 @@ class _WaitingRoomPrivatePageState extends State<WaitingRoomPrivatePage> {
_buildTopButtons(), _buildTopButtons(),
const SizedBox(height: 20), const SizedBox(height: 20),
// const Text('사회자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
// const SizedBox(height: 8),
// _buildAdminSection(),
// const SizedBox(height: 20),
const Text('참가자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), const Text('참가자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
const SizedBox(height: 8), const SizedBox(height: 8),
_buildPlayerSection(), _buildPlayerSection(),
], ],
), ),
), ),
),
); );
} }
// Widget _buildAdminSection() {
// final adminList = _userList.where((u) {
// final t = (u['participant_type'] ?? '').toString().toUpperCase();
// return t == 'ADMIN';
// }).toList();
// return Container(
// padding: const EdgeInsets.all(8),
// decoration: BoxDecoration(
// color: Colors.white,
// border: Border.all(color: Colors.black),
// borderRadius: BorderRadius.circular(8),
// ),
// child: adminList.isEmpty
// ? const Text('사회자가 없습니다.')
// : Wrap(
// spacing: 16,
// runSpacing: 8,
// children: adminList.map(_buildSeat).toList(),
// ),
// );
// }
Widget _buildPlayerSection() { Widget _buildPlayerSection() {
final playerList = _userList.where((u) { final playerList = _userList.where((u) {
final t = (u['user_seq'] ?? null); final t = (u['user_seq'] ?? null);

View File

@ -344,7 +344,7 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
} }
// -> // ->
Future<void> _onLeaveRoom() async { Future<bool> _onLeaveRoom() async {
if (roomMasterYn == 'Y') { if (roomMasterYn == 'Y') {
final confirm = await showDialog<bool>( final confirm = await showDialog<bool>(
context: context, context: context,
@ -388,7 +388,7 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
); );
}, },
); );
if (confirm != true) return; if (confirm != true) return false;
// leave API // leave API
setState(() {_roomExitYn = 'Y';}); setState(() {_roomExitYn = 'Y';});
@ -397,6 +397,7 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
setState(() {_roomExitYn = 'Y';}); setState(() {_roomExitYn = 'Y';});
await _requestLeaveRoom(); await _requestLeaveRoom();
} }
return false;
} }
int _toInt(dynamic val, int defaultVal) { int _toInt(dynamic val, int defaultVal) {
@ -581,7 +582,9 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final countdownStr = _formatDuration(_remaining); final countdownStr = _formatDuration(_remaining);
return Scaffold( return WillPopScope(
onWillPop: () => _onLeaveRoom(),
child: Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.black, backgroundColor: Colors.black,
@ -604,7 +607,7 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
), ),
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: Colors.white), icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: _onLeaveRoom, onPressed: () => _onLeaveRoom(),
), ),
), ),
bottomNavigationBar: _isBannerReady && _bannerAd != null bottomNavigationBar: _isBannerReady && _bannerAd != null
@ -625,11 +628,6 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
_buildTopButtons(), _buildTopButtons(),
const SizedBox(height: 20), const SizedBox(height: 20),
// const Text('사회자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black)),
// const SizedBox(height: 8),
// _buildAdminSection(),
// const SizedBox(height: 20),
const Text('팀별 참가자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black)), const Text('팀별 참가자', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black)),
const SizedBox(height: 8), const SizedBox(height: 8),
_buildTeamSection(), _buildTeamSection(),
@ -639,32 +637,10 @@ class _WaitingRoomTeamPageState extends State<WaitingRoomTeamPage> {
], ],
), ),
), ),
),
); );
} }
// Widget _buildAdminSection() {
// final adminList = _userList.where((u) {
// final pType = (u['participant_type'] ?? '').toString().toUpperCase();
// return pType == 'ADMIN';
// }).toList();
// return Container(
// padding: const EdgeInsets.all(8),
// decoration: BoxDecoration(
// color: Colors.white,
// border: Border.all(color: Colors.black),
// borderRadius: BorderRadius.circular(8),
// ),
// child: adminList.isEmpty
// ? const Text('사회자가 없습니다.', style: TextStyle(color: Colors.black))
// : Wrap(
// spacing: 16,
// runSpacing: 8,
// children: adminList.map(_buildSeat).toList(),
// ),
// );
// }
Widget _buildTeamSection() { Widget _buildTeamSection() {
final players = _userList.where((u) { final players = _userList.where((u) {
final t = (u['user_seq'] ?? null); final t = (u['user_seq'] ?? null);