diff --git a/client/analysis_options.yaml b/client/analysis_options.yaml index eae1670c..018a8a93 100644 --- a/client/analysis_options.yaml +++ b/client/analysis_options.yaml @@ -1,4 +1,6 @@ include: package:lint/analysis_options.yaml analyzer: exclude: - - lib/**/*.pb*.dart \ No newline at end of file + - lib/**/*.pb*.dart + - lib/test-server.dart + - test/**/*.mocks.dart \ No newline at end of file diff --git a/client/fonts/DancingScript-Medium.ttf b/client/fonts/DancingScript-Medium.ttf new file mode 100644 index 00000000..1d96569e Binary files /dev/null and b/client/fonts/DancingScript-Medium.ttf differ diff --git a/client/fonts/DancingScript-Regular.ttf b/client/fonts/DancingScript-Regular.ttf new file mode 100644 index 00000000..f7437834 Binary files /dev/null and b/client/fonts/DancingScript-Regular.ttf differ diff --git a/client/fonts/PermanentMarker-Regular.ttf b/client/fonts/PermanentMarker-Regular.ttf new file mode 100644 index 00000000..6541e9d8 Binary files /dev/null and b/client/fonts/PermanentMarker-Regular.ttf differ diff --git a/client/images/pytorch-logo.png b/client/images/pytorch-logo.png new file mode 100644 index 00000000..6d6dfb2c Binary files /dev/null and b/client/images/pytorch-logo.png differ diff --git a/client/images/tf-logo.png b/client/images/tf-logo.png new file mode 100644 index 00000000..f8852458 Binary files /dev/null and b/client/images/tf-logo.png differ diff --git a/client/lib/protos/pkg/pr12er/messages.pb.dart b/client/lib/protos/pkg/pr12er/messages.pb.dart index af41bbbb..2ca1a4c0 100644 --- a/client/lib/protos/pkg/pr12er/messages.pb.dart +++ b/client/lib/protos/pkg/pr12er/messages.pb.dart @@ -245,21 +245,23 @@ class Detail extends $pb.GeneratedMessage { class Paper extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Paper', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pkg.pr12er'), createEmptyInstance: create) ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'paperId') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'arxivId') - ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'absract') - ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'pubDate') - ..pPS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'authors') - ..pc(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'repositories', $pb.PbFieldType.PM, subBuilder: Repository.create) - ..pc(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'methods', $pb.PbFieldType.PM, subBuilder: Method.create) + ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'title') + ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'arxivId') + ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'absract') + ..aOM<$1.Timestamp>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'pubDate', subBuilder: $1.Timestamp.create) + ..pPS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'authors') + ..pc(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'repositories', $pb.PbFieldType.PM, subBuilder: Repository.create) + ..pc(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'methods', $pb.PbFieldType.PM, subBuilder: Method.create) ..hasRequiredFields = false ; Paper._() : super(); factory Paper({ $core.String? paperId, + $core.String? title, $core.String? arxivId, $core.String? absract, - $core.String? pubDate, + $1.Timestamp? pubDate, $core.Iterable<$core.String>? authors, $core.Iterable? repositories, $core.Iterable? methods, @@ -268,6 +270,9 @@ class Paper extends $pb.GeneratedMessage { if (paperId != null) { _result.paperId = paperId; } + if (title != null) { + _result.title = title; + } if (arxivId != null) { _result.arxivId = arxivId; } @@ -319,40 +324,51 @@ class Paper extends $pb.GeneratedMessage { void clearPaperId() => clearField(1); @$pb.TagNumber(2) - $core.String get arxivId => $_getSZ(1); + $core.String get title => $_getSZ(1); @$pb.TagNumber(2) - set arxivId($core.String v) { $_setString(1, v); } + set title($core.String v) { $_setString(1, v); } @$pb.TagNumber(2) - $core.bool hasArxivId() => $_has(1); + $core.bool hasTitle() => $_has(1); @$pb.TagNumber(2) - void clearArxivId() => clearField(2); + void clearTitle() => clearField(2); @$pb.TagNumber(3) - $core.String get absract => $_getSZ(2); + $core.String get arxivId => $_getSZ(2); @$pb.TagNumber(3) - set absract($core.String v) { $_setString(2, v); } + set arxivId($core.String v) { $_setString(2, v); } @$pb.TagNumber(3) - $core.bool hasAbsract() => $_has(2); + $core.bool hasArxivId() => $_has(2); @$pb.TagNumber(3) - void clearAbsract() => clearField(3); + void clearArxivId() => clearField(3); @$pb.TagNumber(4) - $core.String get pubDate => $_getSZ(3); + $core.String get absract => $_getSZ(3); @$pb.TagNumber(4) - set pubDate($core.String v) { $_setString(3, v); } + set absract($core.String v) { $_setString(3, v); } @$pb.TagNumber(4) - $core.bool hasPubDate() => $_has(3); + $core.bool hasAbsract() => $_has(3); @$pb.TagNumber(4) - void clearPubDate() => clearField(4); + void clearAbsract() => clearField(4); @$pb.TagNumber(5) - $core.List<$core.String> get authors => $_getList(4); + $1.Timestamp get pubDate => $_getN(4); + @$pb.TagNumber(5) + set pubDate($1.Timestamp v) { setField(5, v); } + @$pb.TagNumber(5) + $core.bool hasPubDate() => $_has(4); + @$pb.TagNumber(5) + void clearPubDate() => clearField(5); + @$pb.TagNumber(5) + $1.Timestamp ensurePubDate() => $_ensure(4); @$pb.TagNumber(6) - $core.List get repositories => $_getList(5); + $core.List<$core.String> get authors => $_getList(5); @$pb.TagNumber(7) - $core.List get methods => $_getList(6); + $core.List get repositories => $_getList(6); + + @$pb.TagNumber(8) + $core.List get methods => $_getList(7); } class Repository extends $pb.GeneratedMessage { diff --git a/client/lib/protos/pkg/pr12er/messages.pbjson.dart b/client/lib/protos/pkg/pr12er/messages.pbjson.dart index 257167b7..77c772d0 100644 --- a/client/lib/protos/pkg/pr12er/messages.pbjson.dart +++ b/client/lib/protos/pkg/pr12er/messages.pbjson.dart @@ -72,17 +72,18 @@ const Paper$json = const { '1': 'Paper', '2': const [ const {'1': 'paper_id', '3': 1, '4': 1, '5': 9, '10': 'paperId'}, - const {'1': 'arxiv_id', '3': 2, '4': 1, '5': 9, '10': 'arxivId'}, - const {'1': 'absract', '3': 3, '4': 1, '5': 9, '10': 'absract'}, - const {'1': 'pub_date', '3': 4, '4': 1, '5': 9, '10': 'pubDate'}, - const {'1': 'authors', '3': 5, '4': 3, '5': 9, '10': 'authors'}, - const {'1': 'repositories', '3': 6, '4': 3, '5': 11, '6': '.pkg.pr12er.Repository', '10': 'repositories'}, - const {'1': 'methods', '3': 7, '4': 3, '5': 11, '6': '.pkg.pr12er.Method', '10': 'methods'}, + const {'1': 'title', '3': 2, '4': 1, '5': 9, '10': 'title'}, + const {'1': 'arxiv_id', '3': 3, '4': 1, '5': 9, '10': 'arxivId'}, + const {'1': 'absract', '3': 4, '4': 1, '5': 9, '10': 'absract'}, + const {'1': 'pub_date', '3': 5, '4': 1, '5': 11, '6': '.google.protobuf.Timestamp', '10': 'pubDate'}, + const {'1': 'authors', '3': 6, '4': 3, '5': 9, '10': 'authors'}, + const {'1': 'repositories', '3': 7, '4': 3, '5': 11, '6': '.pkg.pr12er.Repository', '10': 'repositories'}, + const {'1': 'methods', '3': 8, '4': 3, '5': 11, '6': '.pkg.pr12er.Method', '10': 'methods'}, ], }; /// Descriptor for `Paper`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List paperDescriptor = $convert.base64Decode('CgVQYXBlchIZCghwYXBlcl9pZBgBIAEoCVIHcGFwZXJJZBIZCghhcnhpdl9pZBgCIAEoCVIHYXJ4aXZJZBIYCgdhYnNyYWN0GAMgASgJUgdhYnNyYWN0EhkKCHB1Yl9kYXRlGAQgASgJUgdwdWJEYXRlEhgKB2F1dGhvcnMYBSADKAlSB2F1dGhvcnMSOgoMcmVwb3NpdG9yaWVzGAYgAygLMhYucGtnLnByMTJlci5SZXBvc2l0b3J5UgxyZXBvc2l0b3JpZXMSLAoHbWV0aG9kcxgHIAMoCzISLnBrZy5wcjEyZXIuTWV0aG9kUgdtZXRob2Rz'); +final $typed_data.Uint8List paperDescriptor = $convert.base64Decode('CgVQYXBlchIZCghwYXBlcl9pZBgBIAEoCVIHcGFwZXJJZBIUCgV0aXRsZRgCIAEoCVIFdGl0bGUSGQoIYXJ4aXZfaWQYAyABKAlSB2FyeGl2SWQSGAoHYWJzcmFjdBgEIAEoCVIHYWJzcmFjdBI1CghwdWJfZGF0ZRgFIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBSB3B1YkRhdGUSGAoHYXV0aG9ycxgGIAMoCVIHYXV0aG9ycxI6CgxyZXBvc2l0b3JpZXMYByADKAsyFi5wa2cucHIxMmVyLlJlcG9zaXRvcnlSDHJlcG9zaXRvcmllcxIsCgdtZXRob2RzGAggAygLMhIucGtnLnByMTJlci5NZXRob2RSB21ldGhvZHM='); @$core.Deprecated('Use repositoryDescriptor instead') const Repository$json = const { '1': 'Repository', diff --git a/client/lib/screens/detail_screen.dart b/client/lib/screens/detail_screen.dart index b3062b1c..e45208fd 100644 --- a/client/lib/screens/detail_screen.dart +++ b/client/lib/screens/detail_screen.dart @@ -1,8 +1,13 @@ import 'package:flutter/material.dart'; import 'package:pr12er/protos/pkg/pr12er/messages.pb.dart'; +import 'package:pr12er/service.dart'; +import 'package:pr12er/widgets/detail/abstract.dart'; import 'package:pr12er/widgets/detail/header.dart'; import 'package:pr12er/utils/extractor.dart'; +import 'package:pr12er/widgets/detail/recommendataion.dart'; +import 'package:pr12er/widgets/detail/repository.dart'; import 'package:pr12er/widgets/detail/youtube.dart'; +import 'package:provider/provider.dart'; class DetailScreenArguments { final Video video; @@ -39,25 +44,64 @@ class DetailScreen extends StatelessWidget { title: Text(args.video.title, key: const ValueKey("$routeName/appBar/title")), ), - body: CustomScrollView( - slivers: [ - SliverList( - delegate: SliverChildListDelegate([ - YoutubeWidget(youtubeId: extractYoutubeId(args.video.link)), - Container( - margin: const EdgeInsets.only(top: 5, left: 10, right: 10), - child: Column( - children: [ - HeaderWidget(video: args.video), - const SizedBox(height: 10), - getHorizontalLine(), - const SizedBox(height: 10), - ], - ), - ) - ])) + body: Column( + children: [ + YoutubeWidget(youtubeId: extractYoutubeId(args.video.link)), + Expanded( + child: CustomScrollView( + slivers: [ + SliverList( + delegate: SliverChildListDelegate([ + Container( + margin: const EdgeInsets.only(top: 5, left: 10, right: 10), + child: Column( + children: [ + HeaderWidget(video: args.video), + const SizedBox(height: 10), + getHorizontalLine(), + const SizedBox(height: 10), + FutureBuilder( + future: context + .read() + .getDetails(args.video.id), + builder: (context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return const Center( + child: CircularProgressIndicator()); + } + + return Column(children: [ + PaperAbstractWidget( + paper: snapshot.data!.paper[0]), + const SizedBox(height: 10), + getHorizontalLine(), + const SizedBox(height: 10), + RecommentationWidget(detail: snapshot.data!), + const SizedBox(height: 10), + getHorizontalLine(), + const SizedBox(height: 10), + RepositoryWidget( + repositories: + snapshot.data!.paper[0].repositories, + ) + ]); + }, + ) + ], + ), + ) + ])) + ], + ), + ), ], ), + floatingActionButton: FloatingActionButton( + onPressed: () { + // Add your onPressed code here! + }, + child: const Icon(Icons.email), + ), ); } } diff --git a/client/lib/screens/main_screen.dart b/client/lib/screens/main_screen.dart index f6892aa1..db802571 100644 --- a/client/lib/screens/main_screen.dart +++ b/client/lib/screens/main_screen.dart @@ -15,7 +15,14 @@ class MainScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - leading: const Icon(Icons.search), + actions: [ + IconButton( + icon: const Icon(Icons.search), + onPressed: () { + // do something + }, + ) + ], title: const Text(appName), ), body: PRVideos()); diff --git a/client/lib/service.dart b/client/lib/service.dart index c3a5ef08..48f75494 100644 --- a/client/lib/service.dart +++ b/client/lib/service.dart @@ -22,6 +22,13 @@ class GrpcClient { return response.videos; } + + Future getDetails(int videoId) async { + final request = GetDetailsRequest(prId: videoId); + final response = await _client.getDetails(request); + + return response.detail; + } } ClientChannel _getKkweonOktetoChannel() { diff --git a/client/lib/test-server.dart b/client/lib/test-server.dart new file mode 100644 index 00000000..c492167e --- /dev/null +++ b/client/lib/test-server.dart @@ -0,0 +1,184 @@ +// ignore: file_names +import 'package:fixnum/fixnum.dart'; +import 'package:grpc/grpc.dart'; +import 'package:pr12er/protos/google/protobuf/timestamp.pb.dart'; +import 'package:pr12er/protos/pkg/pr12er/messages.pb.dart'; + +import 'protos/pkg/pr12er/service.pbgrpc.dart'; + +class GreeterService extends Pr12erServiceBase { + @override + Future getHello(ServiceCall call, HelloRequest request) async { + return HelloResponse()..body = 'Hello, ${request.body}'; + } + + @override + Future getVideos( + ServiceCall call, GetVideosRequest request) async { + final List