Skip to content

Commit c681101

Browse files
committed
platform related issue
1 parent 1871089 commit c681101

12 files changed

Lines changed: 51 additions & 123 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

APP(FE)/lib/components/default_circle_avatar.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter/foundation.dart' show kIsWeb;
32

43
class DefaultCircleAvatar extends StatelessWidget {
54
final double size;
@@ -10,7 +9,7 @@ class DefaultCircleAvatar extends StatelessWidget {
109
Widget build(BuildContext context) {
1110
return CircleAvatar(
1211
foregroundImage: (AssetImage(
13-
(kIsWeb ? "" : "assets/") + 'images/default_profile_image.png')),
12+
(Theme.of(context).platform == TargetPlatform.android ? "assets/": "") + 'images/default_profile_image.png')),
1413
radius: size,
1514
);
1615
}

APP(FE)/lib/components/homeScreen/feed_page_appbar.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import 'package:app/components/homeScreen/search_modal_bottom_sheet.dart';
22
import 'package:app/constants/colors.dart';
33
import 'package:flutter/material.dart';
44
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
5-
import 'package:flutter/foundation.dart' show kIsWeb;
6-
75
// AppBar FeedPageAppBar(BuildContext context) {
86
// return AppBar(
97
// backgroundColor: Color(COLOR_PRIMARY2),
@@ -48,9 +46,9 @@ AppBar FeedPageAppBar(BuildContext context) {
4846
backgroundColor: Color(COLOR_PRIMARY),
4947
elevation: 0.5,
5048
title: GestureDetector(
51-
child: const Center(
49+
child: Center(
5250
child: Image(
53-
image: AssetImage((kIsWeb ? "" : "assets/") + 'images/logo.png'),
51+
image: AssetImage((Theme.of(context).platform == TargetPlatform.android ? "assets/": "") + 'images/logo.png'),
5452
width: 50,
5553
height: 50,
5654
fit: BoxFit.cover,

APP(FE)/lib/components/unit_lib_page/unit_book_display.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import 'package:app/models/unit_book_models.dart';
44
import 'package:app/screens/detail_screen.dart';
55
import 'package:flutter/material.dart';
66
import 'package:transparent_image/transparent_image.dart';
7-
import 'package:flutter/foundation.dart' show kIsWeb;
7+
8+
89

910
class UnitBookDisplay extends StatelessWidget {
1011
/*const UnitBookDisplay({
@@ -45,7 +46,7 @@ class UnitBookDisplay extends StatelessWidget {
4546
builder: (_) => DetailScreen(
4647
book: convertUnitBooktoBook(bookData!)),
4748
),
48-
);
49+
);
4950
},
5051
child: Container(
5152
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0),
@@ -65,17 +66,16 @@ class UnitBookDisplay extends StatelessWidget {
6566
? Image(
6667
width: imageWidth,
6768
height: imageHeight,
68-
image: AssetImage(
69-
(kIsWeb ? "" : "assets/") + 'images/default_book_cover_image.png'),
69+
image: AssetImage((Theme.of(context).platform == TargetPlatform.android ? "assets/":"") +
70+
'images/default_book_cover_image.png'),
7071
fit: BoxFit.cover,
7172
)
7273
: FadeInImage.memoryNetwork(
7374
width: imageWidth,
7475
height: imageHeight,
7576
placeholder: kTransparentImage,
76-
image: //"http://175.210.134.48:5000/" +
77-
bookData!.coverUrl!
78-
.replaceAll('\\/', '/'),
77+
image: bookData!.coverUrl!
78+
.replaceAll('\\/', '/'),
7979
fit: BoxFit.cover,
8080
),
8181
),

APP(FE)/lib/hooks/use_api.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import 'package:http/http.dart' as http;
33
import 'package:flutter_dotenv/flutter_dotenv.dart';
44
import 'package:transparent_image/transparent_image.dart';
55
import 'package:xml/xml.dart';
6+
import 'package:app/constants/uri.dart';
67
import 'package:intl/intl.dart';
78

89
String aladinHost = "www.aladin.co.kr";
910
const String proxyUri = '';
1011
String aladinFeedPath = "ttb/api/ItemLookUp.aspx";
1112
String aladinSearchPath = "ttb/api/ItemSearch.aspx";
1213
String aladinCategoryPath = "ttb/api/ItemList.aspx";
13-
String proxy = "http://175.210.134.48:5000/";
14+
String proxy = "https://hyejin-degreeshow.site/proxy/";
1415
//https://cors-anywhere.herokuapp.com/
1516

1617
Map<String, String> _monthMap = {
@@ -48,7 +49,7 @@ Future<Map<String, dynamic>> searchAladinApiGet(String query, int page) async {
4849
http.Response response = await http.get(
4950
Uri.parse(proxy +
5051
Uri(
51-
scheme: "http",
52+
scheme: "https",
5253
host: aladinHost,
5354
path: aladinSearchPath,
5455
queryParameters: _param)
@@ -78,7 +79,7 @@ Future<Map<String, dynamic>> feedAladinApiGet(String isbn13) async {
7879
http.Response response = await http.get(
7980
Uri.parse(proxy +
8081
Uri(
81-
scheme: "http",
82+
scheme: "https",
8283
host: aladinHost,
8384
path: aladinFeedPath,
8485
queryParameters: _param)
@@ -135,7 +136,7 @@ Future<Map<String, dynamic>> feedAladinCategoryApi(
135136
http.Response response = await http.get(
136137
Uri.parse(proxy +
137138
Uri(
138-
scheme: "http",
139+
scheme: "https",
139140
host: aladinHost,
140141
path: aladinCategoryPath,
141142
queryParameters: _param)
@@ -145,8 +146,7 @@ Future<Map<String, dynamic>> feedAladinCategoryApi(
145146
}
146147

147148
///////////////// detailpage sync //////////////////////
148-
const String myUri = 'https://www.projectlib.tk';
149-
// const String myUri = 'http://175.210.134.48:3000/';
149+
150150

151151
Future<Map<String, dynamic>> getUnitBookInfo(String unit, String isbn) async {
152152
const path = "/unit/chk/";

APP(FE)/lib/models/unit_book_models.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ List<UnitBook> parseUnitBook(dynamic decodedResponseBody) {
5252
}
5353

5454
List<UnitBook> parseBorrowBook(dynamic decodedResponseBody) {
55-
return (decodedResponseBody as List)
55+
return (decodedResponseBody['books_list'] as List)
5656
.map((i) => UnitBook.fromJson(i))
5757
.toList();
5858
}
@@ -81,7 +81,10 @@ Future<List<UnitBook>> getUnitTagBookList(String unit, String tag) async {
8181

8282
Future<List<UnitBook>> getBorrowBookList(String unit) async {
8383
final response = await http.get(
84-
Uri.parse(proxyUri + myUri + 'mypage/borrow_list?user_id=${myUser!.userId}'),
84+
Uri.parse(proxyUri +
85+
myUri +
86+
'unit/chk/Unit_name=${myUser!.unit}&user_id=${myUser!.userId}'),
87+
8588

8689
headers: <String, String>{
8790
'Content-Type': 'application/json; charset=UTF-8',

APP(FE)/lib/navigation/routes.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:app/pages/post_page.dart';
77
import 'package:app/pages/post_write_page.dart';
88
import 'package:app/pages/register_page.dart';
99
import 'package:app/pages/setting_page.dart';
10-
import 'package:app/pages/unit_book_detail_page.dart';
1110
import 'package:app/pages/unit_lib_book_list_page.dart';
1211
import 'package:app/pages/unit_lib_page.dart';
1312
import 'package:app/screens/detail_screen.dart';
@@ -25,7 +24,7 @@ final routes = {
2524
// '/home/feed': (BuildContext context) => FeedPage(),
2625
// '/home/mybook': (BuildContext context) => MyBookPage(),
2726
// '/home/unitlib': (BuildContext context) => UnitLibPage(),
28-
'/home/unitlib/book-detail': (BuildContext context) => UnitBookDetailPage(),
27+
// '/home/unitlib/book-detail': (BuildContext context) => UnitBookDetailPage(),
2928
'/home/unitlib/list': (BuildContext context) => UnitLibBookListPage(),
3029
'/home/forum': (BuildContext context) => ForumScreen(),
3130
'/home/forum/post-list': (BuildContext context) => PostListPage(),

APP(FE)/lib/pages/login_page.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:app/components/login_page/rounded_password_field.dart';
77
import 'package:app/components/underlined_text.dart';
88
import 'package:app/constants/colors.dart';
99
import 'package:app/controller/user_controller.dart';
10-
import 'package:flutter/foundation.dart' show kIsWeb;
10+
1111
import 'package:flutter/material.dart';
1212

1313
class LoginPage extends StatefulWidget {
@@ -71,7 +71,10 @@ class _LoginPageState extends State<LoginPage> {
7171
thickness: 7),
7272
Image(
7373
image: AssetImage(
74-
(kIsWeb ? "" : "assets/") + 'images/login.jpg'),
74+
(Theme.of(context).platform == TargetPlatform.android
75+
? "assets/"
76+
: "") +
77+
'images/login.jpg'),
7578
height: size.height * 0.4,
7679
),
7780
SizedBox(height: size.height * 0.03),

APP(FE)/lib/pages/register_page.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import 'package:email_validator/email_validator.dart';
1616
import 'package:image_picker/image_picker.dart';
1717
import 'package:flutter/cupertino.dart';
1818
import 'package:shared_preferences/shared_preferences.dart';
19-
import 'package:flutter/foundation.dart' show kIsWeb;
2019

2120
class RegisterPage extends StatefulWidget {
2221
@override
@@ -264,7 +263,7 @@ class _RegisterPageState extends State<RegisterPage> {
264263
}
265264

266265
_onCameraClick() async {
267-
if (kIsWeb) {
266+
if (Theme.of(context).platform != TargetPlatform.android ) {
268267
showDialog<String>(
269268
context: context,
270269
builder: (BuildContext context) => AlertDialog(

APP(FE)/lib/pages/setting_page.dart

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import 'package:flutter/material.dart';
1010
import 'package:app/components/titled_appbar.dart';
1111
import 'package:image_picker/image_picker.dart';
1212
import 'package:shared_preferences/shared_preferences.dart';
13-
import 'package:flutter/foundation.dart' show kIsWeb;
1413

1514
final Map<String, TextEditingController> modifySettingController = {
1615
"email": TextEditingController(),
@@ -45,7 +44,7 @@ class _SettingPageState extends State<SettingPage> {
4544
}
4645

4746
_onCameraClick() async {
48-
if (kIsWeb) {
47+
if (Theme.of(context).platform != TargetPlatform.android) {
4948
showDialog<String>(
5049
context: context,
5150
builder: (BuildContext context) => AlertDialog(
@@ -60,22 +59,21 @@ class _SettingPageState extends State<SettingPage> {
6059
],
6160
),
6261
);
63-
} else{
64-
ImagePicker _imagePicker = imagePicker;
65-
XFile? image = await _imagePicker.pickImage(source: ImageSource.gallery);
66-
SharedPreferences prefs = await SharedPreferences.getInstance();
67-
if (image != null) {
68-
prefs.setString('profileImage', image.path);
69-
Future.delayed(const Duration(milliseconds: 500), () {
70-
setState(() {
71-
_profileImage = File(image.path);
62+
} else {
63+
ImagePicker _imagePicker = imagePicker;
64+
XFile? image = await _imagePicker.pickImage(source: ImageSource.gallery);
65+
SharedPreferences prefs = await SharedPreferences.getInstance();
66+
if (image != null) {
67+
prefs.setString('profileImage', image.path);
68+
Future.delayed(const Duration(milliseconds: 500), () {
69+
setState(() {
70+
_profileImage = File(image.path);
71+
});
72+
final snackbar = SnackBar(content: Text('성공적으로 변경되었습니다.'));
73+
ScaffoldMessenger.of(context).showSnackBar(snackbar);
7274
});
73-
final snackbar = SnackBar(content: Text('성공적으로 변경되었습니다.'));
74-
ScaffoldMessenger.of(context).showSnackBar(snackbar);
75-
});
76-
}
75+
}
7776
}
78-
7977
}
8078

8179
@override
@@ -154,9 +152,15 @@ ImagePicker _imagePicker = imagePicker;
154152
fontSize: 15, color: Colors.black54),
155153
),
156154
// ProfileEditTile(myUser!, "username"),
157-
ProfileEditTile("email", (){setState(() {});}),
158-
ProfileEditTile("unit", (){setState(() {});}),
159-
ProfileEditTile("rank", (){setState(() {});}),
155+
ProfileEditTile("email", () {
156+
setState(() {});
157+
}),
158+
ProfileEditTile("unit", () {
159+
setState(() {});
160+
}),
161+
ProfileEditTile("rank", () {
162+
setState(() {});
163+
}),
160164
const SizedBox(height: 15),
161165

162166
RoundedButton(

0 commit comments

Comments
 (0)