Skip to content

Commit

Permalink
Merge pull request #17 from TeamDaitda/feature/서버-연동
Browse files Browse the repository at this point in the history
Feature/서버 연동
  • Loading branch information
Dev-Beom authored May 3, 2021
2 parents eccc963 + 5b4c5cc commit 091dd31
Show file tree
Hide file tree
Showing 18 changed files with 515 additions and 126 deletions.
72 changes: 72 additions & 0 deletions daitda/lib/model/image/imageGetByUserIdDto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'dart:convert';

ImageFindByUserIdDto imageFindByUserIdDtoFromJson(String str) =>
ImageFindByUserIdDto.fromJson(json.decode(str));

String imageFindByUserIdDtoToJson(ImageFindByUserIdDto data) =>
json.encode(data.toJson());

class ImageFindByUserIdDto {
ImageFindByUserIdDto({
this.id,
this.path,
this.users,
});

int id;
String path;
Users users;

factory ImageFindByUserIdDto.fromJson(Map<String, dynamic> json) =>
ImageFindByUserIdDto(
id: json["id"],
path: json["path"],
users: Users.fromJson(json["users"]),
);

Map<String, dynamic> toJson() => {
"id": id,
"path": path,
"users": users.toJson(),
};
}

class Users {
Users({
this.createDate,
this.modifiedDate,
this.id,
this.name,
this.affiliation,
this.phone,
this.category,
});

dynamic createDate;
dynamic modifiedDate;
int id;
String name;
String affiliation;
String phone;
int category;

factory Users.fromJson(Map<String, dynamic> json) => Users(
createDate: json["createDate"],
modifiedDate: json["modifiedDate"],
id: json["id"],
name: json["name"],
affiliation: json["affiliation"],
phone: json["phone"],
category: json["category"],
);

Map<String, dynamic> toJson() => {
"createDate": createDate,
"modifiedDate": modifiedDate,
"id": id,
"name": name,
"affiliation": affiliation,
"phone": phone,
"category": category,
};
}
55 changes: 55 additions & 0 deletions daitda/lib/model/user/userGetAllDto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'dart:convert';

UserGetAllDto userGetAllDtoFromJson(String str) =>
UserGetAllDto.fromJson(json.decode(str));

String userGetAllDtoToJson(UserGetAllDto data) => json.encode(data.toJson());

class UserGetAllDto {
UserGetAllDto({
this.result,
});

List<Result> result;

factory UserGetAllDto.fromJson(Map<String, dynamic> json) => UserGetAllDto(
result:
List<Result>.from(json["result"].map((x) => Result.fromJson(x))),
);

Map<String, dynamic> toJson() => {
"result": List<dynamic>.from(result.map((x) => x.toJson())),
};
}

class Result {
Result({
this.id,
this.name,
this.affiliation,
this.phone,
this.category,
});

int id;
String name;
String affiliation;
String phone;
int category;

factory Result.fromJson(Map<String, dynamic> json) => Result(
id: json["id"],
name: json["name"],
affiliation: json["affiliation"],
phone: json["phone"],
category: json["category"],
);

Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"affiliation": affiliation,
"phone": phone,
"category": category,
};
}
38 changes: 38 additions & 0 deletions daitda/lib/model/user/userGetDto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'dart:convert';

UserGetDto userGetDtoFromJson(String str) =>
UserGetDto.fromJson(json.decode(str));

String userGetDtoToJson(UserGetDto data) => json.encode(data.toJson());

class UserGetDto {
UserGetDto({
this.id,
this.name,
this.affiliation,
this.phone,
this.category,
});

int id;
String name;
String affiliation;
String phone;
int category;

factory UserGetDto.fromJson(Map<String, dynamic> json) => UserGetDto(
id: json["id"],
name: json["name"],
affiliation: json["affiliation"],
phone: json["phone"],
category: json["category"],
);

Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"affiliation": affiliation,
"phone": phone,
"category": category,
};
}
188 changes: 116 additions & 72 deletions daitda/lib/pages/homePage.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'package:daitda/pages/categoryPage.dart';
import 'package:daitda/pages/galleryPage.dart';
import 'package:daitda/service/adApi.dart';
import 'package:daitda/service/imageApi.dart';
import 'package:daitda/service/userService.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand All @@ -15,105 +18,146 @@ class HomePage extends StatefulWidget {
}

class _HomePageState extends State<HomePage> {
// http test
UserApi userApi = new UserApi();
ImageApi imageApi = new ImageApi();
AdApi adApi = new AdApi();

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xff2C2F33),
body: Stack(
children: <Widget>[

Center(
child: Opacity(
child: SvgPicture.asset(
'images/sym.svg',
width:830,
height: 830,
),
opacity: 0.05,
child: SvgPicture.asset(
'images/sym.svg',
width: 830,
height: 830,
),
opacity: 0.05,
),
),


Padding(
padding: const EdgeInsets.only(left: 10, bottom: 100),
child: Center(
child: SvgPicture.asset(
'images/text.svg',
width:110,
height:110,
)
),
child: SvgPicture.asset(
'images/text.svg',
width: 110,
height: 110,
)),
),



Padding(
padding: const EdgeInsets.fromLTRB(0,420, 0, 0),
padding: const EdgeInsets.fromLTRB(0, 420, 0, 0),
child: Center(
child: Column(
children: [
OutlinedButton(
onPressed: () async {
// userApi
// .save(
// affiliation: "소속입니다",
// category: 1234,
// name: "이름입니다",
// phone: "휴대폰입니다")
// .then((value) => print(value));
//
//
// userApi
// .update(id: 20, categoryId: 10)
// .then((value) => print(value));
//
//
// userApi.get(id: 3).then((value) {
// print(value.id);
// print(value.name);
// print(value.category);
// print(value.affiliation);
// print(value.phone);
// });
//
// userApi.getAll().then((value) {
// value.result.forEach((element) {
// print(element.id);
// print(element.name);
// print(element.category);
// print(element.affiliation);
// print(element.phone);
// });
// });
//
// imageApi.imageFindByUserIdDto(id: 1).then((value) {
// print(value.id);
// print(value.path);
// print(value.users.id);
// print(value.users.category);
// print(value.users.affiliation);
// print(value.users.createDate);
// print(value.users.modifiedDate);
// print(value.users.name);
// print(value.users.phone);
// });
//
adApi.update(id: 1).then((value) => print(value));
},
child: Text("테스트"),
),
Text(
'Draw your line,',
style: TextStyle(
fontSize: 26,
color: Colors.white,
fontSize: 26,
color: Colors.white,
),
),
),

Text(
Text(
'Makes our life,',
style: TextStyle(
fontSize: 26,
color: Colors.white,
),
),

SizedBox(
height: 10,
),


Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
Get.toNamed('/galleryPage');
},
child: Text('갤러리',style: TextStyle(
fontSize: 22,
color: Colors.white,
),),),

SizedBox(
width: 14.0,
fontSize: 26,
color: Colors.white,
),

TextButton(
onPressed: () {
Get.toNamed('/categoryPage');
},
child: Text('시작하기',style: TextStyle(
fontSize: 22,
color: Colors.white,
),),),

],
)
],
),
),
)

),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
Get.toNamed('/galleryPage');
},
child: Text(
'갤러리',
style: TextStyle(
fontSize: 22,
color: Colors.white,
),
),
),
SizedBox(
width: 14.0,
),
TextButton(
onPressed: () {
Get.toNamed('/categoryPage');
},
child: Text(
'시작하기',
style: TextStyle(
fontSize: 22,
color: Colors.white,
),
),
),
],
)
],
),
),
)
],
),
);
}
}







Loading

0 comments on commit 091dd31

Please sign in to comment.