Commit d0cb3c3f authored by Manuel Herold's avatar Manuel Herold

added third visualization of community

parent 1a3d8c05
2021/03/11-17:11:28.608 327c Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6b130dbd\flutter_tools_chrome_device.2edc2a21\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/11-17:11:28.608 327c Recovering log #3
2021/03/11-17:11:28.608 327c Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.6b130dbd\flutter_tools_chrome_device.2edc2a21\Default\AutofillStrikeDatabase/000003.log
2021/03/15-10:50:41.644 240c Reusing MANIFEST C:\Users\herry\AppData\Local\Temp\flutter_tools.bde5ff4\flutter_tools_chrome_device.ff9a4229\Default\AutofillStrikeDatabase/MANIFEST-000001
2021/03/11-17:11:28.602 327c Reusing MANIFEST C:\Users\Luca\AppData\Local\Temp\flutter_tools.6b130dbd\flutter_tools_chrome_device.2edc2a21\Default\BudgetDatabase/MANIFEST-000001
2021/03/11-17:11:28.603 327c Recovering log #3
2021/03/11-17:11:28.603 327c Reusing old log C:\Users\Luca\AppData\Local\Temp\flutter_tools.6b130dbd\flutter_tools_chrome_device.2edc2a21\Default\BudgetDatabase/000003.log
2021/03/15-10:50:41.641 52b4 Reusing MANIFEST C:\Users\herry\AppData\Local\Temp\flutter_tools.bde5ff4\flutter_tools_chrome_device.ff9a4229\Default\BudgetDatabase/MANIFEST-000001
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -78,13 +78,13 @@ define(['dart_sdk', 'packages/flutter/src/widgets/widget_span.dart', 'packages/f
[_Location_name]: null,
[_Location_column]: 12,
[_Location_line]: 117,
[_Location_file]: "file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/packages/flutter/lib/src/material/page.dart"
[_Location_file]: "file:///D:/Libs/flutter/packages/flutter/lib/src/material/page.dart"
});
}
}, false);
var C = Array(6).fill(void 0);
var I = [
"file:///C:/Users/Luca/Documents/flutter/flutter_windows_1.22.5-stable/flutter/packages/flutter/lib/src/material/page.dart",
"file:///D:/Libs/flutter/packages/flutter/lib/src/material/page.dart",
"package:flutter/src/material/page.dart"
];
var builder$ = dart.privateName(page, "MaterialPageRoute.builder");
......@@ -338,7 +338,7 @@ define(['dart_sdk', 'packages/flutter/src/widgets/widget_span.dart', 'packages/f
dart.trackLibraries("packages/flutter/src/material/page.dart", {
"package:flutter/src/material/page.dart": page
}, {
}, '{"version":3,"sourceRoot":"","sources":["page.dart"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFqC;MAAiC;;AAGzC;MAAI;;AAGH;MAAI;;YAGc;AAE5C,cAAkB,AAChB,sCADM,SAAS,gBAAqC,AAAU,SAAD,sBAC/C,uCAAV,SAAS,gBAAsC,AAAU,SAAD;MAChE;gBAIe,SACK,WACA;YAFL;YACK;YACA;AAEL,qBAAS,kBAAa,OAAO;AAC1C,uBAAO,AAQN;AAPC,cAAI,AAAO,MAAD;AAIP,YAHD,WAAM,4BAAY,AAChB,sCAA0B,AAAS,sBAAK,wBACxC;;AAGJ,gBAAO;;AAET,cAAO,uCACQ,0BACO,aACb,MAAM;MAEjB;uBAGqC,SAA2B,WAA6B,oBAA2B;YAAnF;YAA2B;YAA6B;YAA2B;AAC3F,oBAAc,AAAY,gBAAT,OAAO;AACnD,cAAO,AAAM,MAAD,qBAAqB,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK;MACtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA7EoB;;;;;;MAMT;;;;;;mBAHsB;;;AAAY,aAAQ,OAAO;cAAf,AAAO;MAAS;;AAMpC,cAAuC,UAA9B,oBAAW,eAAG,AAAS,sBAAK;MAAE;;;UArBhD;;UACC;UACV;;UACA;;MAHS;MAET;YAEK,AAAQ,OAAD;YACP,AAAc,aAAD;YACb,AAAiB,gBAAD;AACvB,4DAAgB,QAAQ,oBAAoB,gBAAgB;AAC/D,qBAAO;IACT;;;;;;;;;;;;;;;;;;;;;;;;;MAsHa;;;;;;MAGF;;;;;;MAGA;;;;;;;YAGuB;AAChC,cAAO,mDAAqC;MAC9C;;;UAvBgB;;UACT;;UACA;;UACK;UACF;UACA;MALM;MACT;MACA;YAIK,AAAM,KAAD;YACL,AAAc,aAAD;YACb,AAAiB,gBAAD;AACvB,kDAAW,GAAG,QAAQ,IAAI,aAAa;;IAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BzB,cAAS,sBAAT;MAA2B;;YAGvB;AAC/B,cAAO,AAAM;MACf;;AAG0B,cAAA,AAAM;MAAa;;AAGhB,cAAA,AAAM;MAAgB;;AAG1B,cAAoC,UAA3B,oBAAW,eAAG,AAAM,oBAAK;MAAE;;;UApBlC;;YACf,AAAK,IAAD;AACX,sEAAgB,IAAI;AACvB,qBAAO;IACT","file":"../../../../../../../../../../../packages/flutter/src/material/page.dart.lib.js"}');
}, '{"version":3,"sourceRoot":"","sources":["page.dart"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFqC;MAAiC;;AAGzC;MAAI;;AAGH;MAAI;;YAGc;AAE5C,cAAkB,AAChB,sCADM,SAAS,gBAAqC,AAAU,SAAD,sBAC/C,uCAAV,SAAS,gBAAsC,AAAU,SAAD;MAChE;gBAIe,SACK,WACA;YAFL;YACK;YACA;AAEL,qBAAS,kBAAa,OAAO;AAC1C,uBAAO,AAQN;AAPC,cAAI,AAAO,MAAD;AAIP,YAHD,WAAM,4BAAY,AAChB,sCAA0B,AAAS,sBAAK,wBACxC;;AAGJ,gBAAO;;AAET,cAAO,uCACQ,0BACO,aACb,MAAM;MAEjB;uBAGqC,SAA2B,WAA6B,oBAA2B;YAAnF;YAA2B;YAA6B;YAA2B;AAC3F,oBAAc,AAAY,gBAAT,OAAO;AACnD,cAAO,AAAM,MAAD,qBAAqB,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK;MACtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA7EoB;;;;;;MAMT;;;;;;mBAHsB;;;AAAY,aAAQ,OAAO;cAAf,AAAO;MAAS;;AAMpC,cAAuC,UAA9B,oBAAW,eAAG,AAAS,sBAAK;MAAE;;;UArBhD;;UACC;UACV;;UACA;;MAHS;MAET;YAEK,AAAQ,OAAD;YACP,AAAc,aAAD;YACb,AAAiB,gBAAD;AACvB,4DAAgB,QAAQ,oBAAoB,gBAAgB;AAC/D,qBAAO;IACT;;;;;;;;;;;;;;;;;;;;;;;;;MAsHa;;;;;;MAGF;;;;;;MAGA;;;;;;;YAGuB;AAChC,cAAO,mDAAqC;MAC9C;;;UAvBgB;;UACT;;UACA;;UACK;UACF;UACA;MALM;MACT;MACA;YAIK,AAAM,KAAD;YACL,AAAc,aAAD;YACb,AAAiB,gBAAD;AACvB,kDAAW,GAAG,QAAQ,IAAI,aAAa;;IAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BzB,cAAS,sBAAT;MAA2B;;YAGvB;AAC/B,cAAO,AAAM;MACf;;AAG0B,cAAA,AAAM;MAAa;;AAGhB,cAAA,AAAM;MAAgB;;AAG1B,cAAoC,UAA3B,oBAAW,eAAG,AAAM,oBAAK;MAAE;;;UApBlC;;YACf,AAAK,IAAD;AACX,sEAAgB,IAAI;AACvB,qBAAO;IACT","file":"../../../../../../../packages/flutter/src/material/page.dart.lib.js"}');
// Exports:
return {
src__material__page: page
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
2.0.1
\ No newline at end of file
2.0.0
\ No newline at end of file
# This is a generated file; do not edit or check into version control.
integration_test=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\packages\\integration_test\\
path_provider=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-1.6.27\\
path_provider_linux=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-0.0.1+2\\
path_provider_macos=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-0.0.4+8\\
path_provider_windows=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-0.0.5\\
integration_test=D:\\Libs\\flutter\\packages\\integration_test\\
path_provider=D:\\Libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-1.6.27\\
path_provider_linux=D:\\Libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-0.0.1+2\\
path_provider_macos=D:\\Libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-0.0.4+8\\
path_provider_windows=D:\\Libs\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-0.0.5\\
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Luca\\\\Documents\\\\flutter\\\\flutter_windows_1.22.5-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-11 17:10:45.273697","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"D:\\\\Libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"D:\\\\Libs\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.27\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\Libs\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.5\\\\","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-03-15 11:05:37.460167","version":"2.0.0"}
\ No newline at end of file
This diff is collapsed.
sdk.dir=C:\\Users\\Luca\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\Users\\Luca\\Documents\\flutter\\flutter_windows_1.22.5-stable\\flutter
\ No newline at end of file
sdk.dir=C:\\Users\\herry\\AppData\\Local\\Android\\sdk
flutter.sdk=D:\\Libs\\flutter
\ No newline at end of file
import 'package:intl/intl.dart';
class Post {
Post(this.title, this.content, this.author, this.community, this.trust,
this.comments);
......@@ -12,4 +14,10 @@ class Post {
if (title != null && title.isNotEmpty) return title;
return content;
}
String get formattedTrustScore {
NumberFormat format = NumberFormat("###.00");
return format.format(trust*100)+"%";
}
}
......@@ -2,15 +2,15 @@ import 'dart:math';
import 'package:circlegraph/circlegraph.dart';
import 'package:dashboard/graphing/trustcolorcalculator.dart';
import 'package:dashboard/ui/graphs/community/node_community.dart';
import 'package:dashboard/ui/graphs/community/circle/node_community.dart';
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import '../../../data/community.dart';
import '../../../data/communityGraphNodeData.dart';
import '../../../data/post.dart';
import '../../../graphing/postnode.dart';
import '../../../../data/community.dart';
import '../../../../data/communityGraphNodeData.dart';
import '../../../../data/post.dart';
import '../../../../graphing/postnode.dart';
class CommunityGraph extends StatefulWidget {
CommunityGraph(this.community, {this.offset = 0});
......@@ -19,6 +19,10 @@ class CommunityGraph extends StatefulWidget {
static const int postsPerPage = 21;
final int offset;
final double padding = 32;
final double postWidth = 200;
final double postHeight = 50;
_CommunityGraphState createState() => _CommunityGraphState(community);
}
......
import 'package:dashboard/data/community.dart';
import 'package:dashboard/data/post.dart';
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:flutter/material.dart';
class CommunityCloud extends StatefulWidget {
@override
_CommunityCloudState createState() => _CommunityCloudState();
final double padding = 32;
final double postWidth = 200;
final double postHeight = 50;
final int offset;
final Community community;
CommunityCloud(this.community, this.offset);
}
class _CommunityCloudState extends State<CommunityCloud> {
int _nextPostId;
Widget _rowBuilder(int n) {
List<Widget> children = [];
for (int i = 0; i < n; i++) {
int postNumber = _nextPostId++;
Post post = widget.community.posts[postNumber];
children.add(
Container(
width: widget.postWidth,
height: widget.postHeight,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Row(
children: [
Icon(
Icons.sticky_note_2,
color: ColorHolder.color2,
),
SizedBox(width: 4),
Expanded(
child: Text(
post.effectiveTitle,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(color: ColorHolder.color2),
),
),
SizedBox(width: 4),
Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Icon(
post.trust > .5
? Icons.thumb_up_sharp
: Icons.thumb_down_sharp,
color: ColorHolder.color2,
size: 15,
),
Text(
post.formattedTrustScore,
style: TextStyle(color: ColorHolder.color2),
),
],
),
],
),
),
);
}
return Padding(
padding: EdgeInsets.only(bottom: widget.padding),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: children,
),
);
}
@override
Widget build(BuildContext context) {
_nextPostId = widget.offset;
return Container(
color: ColorHolder.color3,
constraints: BoxConstraints.expand(),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
int postsPerRow =
constraints.maxWidth ~/ (widget.postWidth + widget.padding);
int nrows =
constraints.maxHeight ~/ (widget.postHeight + widget.padding);
return Padding(
padding: EdgeInsets.only(top: widget.padding),
child: Column(
children: [
for (int i = 0; i < nrows; i++)
_rowBuilder(postsPerRow - (i % 2)),
],
),
);
},
),
);
}
}
......@@ -4,7 +4,9 @@ import 'package:dashboard/data/community.dart';
import 'package:dashboard/graphing/communitymetagraph.dart';
import 'package:dashboard/loading.dart';
import 'package:dashboard/querying/datagetter.dart';
import 'package:dashboard/ui/graphs/community/communitygraph.dart';
import 'package:dashboard/ui/graphs/community/circle/communitygraph.dart';
import 'package:dashboard/ui/graphs/community/cloud/communitycloud.dart';
import 'package:dashboard/ui/graphs/community/list/community_list.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:enhanced_future_builder/enhanced_future_builder.dart';
import 'package:flutter/material.dart';
......@@ -23,8 +25,21 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
int _endIndex = 0;
Community _data;
bool _inCloudMode = true;
void initState() {
super.initState();
_fetchData();
}
void _fetchData() async {
_data = await DataGetter.getCommunity(widget.communityname);
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => CommunityList(_data, 0),
),
);
}
void _onNext() {
......@@ -48,74 +63,96 @@ class _CommunityGraphViewPageState extends State<CommunityGraphViewPage> {
});
}
void _toggleCloudMode(BuildContext context) {
setState(() {
_inCloudMode = !_inCloudMode;
});
}
Widget build(BuildContext context) {
_endIndex = _startIndex + CommunityGraph.postsPerPage;
return LoadingScreen(message: "Fetching posts...");
return Scaffold(
appBar: LoggedInAppBar("Community: ${widget.communityname}"),
backgroundColor: Colors.white,
floatingActionButton: Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 32),
FloatingActionButton(
onPressed: () => redirectToCommunityMetaGraph(context),
child: Icon(Icons.zoom_out),
),
],
),
),
FloatingActionButton(
onPressed: _onPrevious,
child: Icon(Icons.arrow_left),
),
SizedBox(width: 8),
Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.all(Radius.circular(20)),
),
width: 200,
height: 60,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
"Post #${_startIndex + 1} - #${_endIndex + 1}",
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
SizedBox(width: 8),
FloatingActionButton(
onPressed: _onNext,
child: Icon(Icons.arrow_right),
)
],
),
body: EnhancedFutureBuilder<Community>(
future: DataGetter.getCommunity(widget.communityname),
rememberFutureResult: false,
whenDone: (result) {
_data = result;
return CommunityGraph(
result,
offset: _startIndex,
);
},
whenNotDone: Container(
alignment: Alignment.center,
child: LoadingScreen(
message: "Fetching Posts...",
),
),
),
);
// return Scaffold(
// appBar: LoggedInAppBar("Community: ${widget.communityname}"),
// backgroundColor: Colors.white,
// floatingActionButton: Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Expanded(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// SizedBox(width: 32),
// FloatingActionButton(
// onPressed: () => redirectToCommunityMetaGraph(context),
// child: Icon(Icons.zoom_out),
// ),
// SizedBox(width: 8),
// FloatingActionButton(
// onPressed: () => _toggleCloudMode(context),
// child: Icon(
// _inCloudMode ? Icons.circle : Icons.cloud,
// ),
// ),
// ],
// ),
// ),
// FloatingActionButton(
// onPressed: _onPrevious,
// child: Icon(Icons.arrow_left),
// ),
// SizedBox(width: 8),
// Container(
// decoration: BoxDecoration(
// color: Theme.of(context).primaryColor,
// borderRadius: BorderRadius.all(Radius.circular(20)),
// ),
// width: 200,
// height: 60,
// alignment: Alignment.center,
// padding: EdgeInsets.symmetric(horizontal: 16),
// child: Text(
// "Post #${_startIndex + 1} - #${_endIndex + 1}",
// style: TextStyle(
// color: Colors.white,
// fontSize: 18,
// ),
// ),
// ),
// SizedBox(width: 8),
// FloatingActionButton(
// onPressed: _onNext,
// child: Icon(Icons.arrow_right),
// )
// ],
// ),
// body: EnhancedFutureBuilder<Community>(
// future: DataGetter.getCommunity(widget.communityname),
// rememberFutureResult: false,
// whenDone: (result) {
// _data = result;
// return _inCloudMode
// ? CommunityList(
// result,
// _startIndex,
// )
// // ? CommunityCloud(
// // result,
// // _startIndex,
// // )
// : CommunityGraph(
// result,
// offset: _startIndex,
// );
// },
// whenNotDone: Container(
// alignment: Alignment.center,
// child: LoadingScreen(
// message: "Fetching Posts...",
// ),
// ),
// ),
// );
}
void redirectToCommunityMetaGraph(BuildContext context) {
......
import 'dart:html';
import 'dart:math';
import 'package:dashboard/data/community.dart';
import 'package:dashboard/ui/graphs/community/list/post_view.dart';
import 'package:dashboard/ui/theme/color_holder.dart';
import 'package:dashboard/ui/util/left_to_right_transition%20copy.dart';
import 'package:dashboard/ui/util/logged_in_appbar.dart';
import 'package:dashboard/ui/util/right_to_left_transition.dart';
import 'package:dashboard/ui/util/scrolldetector.dart';
import 'package:flutter/material.dart';
class CommunityList extends StatefulWidget {
@override
_CommunityListState createState() => _CommunityListState();
final int offset;
final Community community;
final int nodesPerPage = 3;
CommunityList(this.community, this.offset);
}
class _CommunityListState extends State<CommunityList> {
void _previous() {
int nextOffset = max(
0,
widget.offset - widget.nodesPerPage,
);
if (nextOffset != widget.offset)
Navigator.of(context).pushReplacement(
LeftToRightTransition(
widget: CommunityList(
widget.community,
nextOffset,
),
),
);
}
void _next() {
int nextOffset = min(
widget.community.posts.length - widget.nodesPerPage,
widget.offset + widget.nodesPerPage,
);
if (nextOffset != widget.offset)
Navigator.of(context).pushReplacement(
RightToLeftTransition(
widget: CommunityList(
widget.community,
nextOffset,
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: LoggedInAppBar("Community: ${widget.community.name}"),
body: ScrollDetector(
onPointerScroll: (event) =>
event.scrollDelta.dy < 0 ? _previous() : _next(),
child: Stack(
children: [
Center(
child: Container(
constraints: BoxConstraints.expand(),
color: ColorHolder.color3,
child: Stack(
children: [
Align(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
for (int i = widget.offset;
i <
min(widget.community.posts.length,
widget.offset + widget.nodesPerPage);
i++)
PostView(
widget.community.posts[i],
index: i + 1,
withExplanation: i == widget.offset,
),
],
),
),
],
),
),
)
],
),
),
);
}
}
import 'package:dashboard/data/post.dart';
import 'package:flutter/material.dart';
class PostView extends StatelessWidget {
final Post post;
final int index;
final bool withExplanation;
PostView(
this.post, {
this.index = -1,
this.withExplanation = false,
});
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
if (withExplanation)
SizedBox(
width: 220,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"User post from the community ${post.community}",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
textAlign: TextAlign.center,
),
Image.asset(
"assets/drawn/line1.png",
width: 200,
),
],
),
),
if (withExplanation)
Image.asset(
"assets/drawn/arrow.png",
width: 200,
),
// post content
Container(
width: 600,
height: 200,
alignment: Alignment.center,
decoration: BoxDecoration(
image: withExplanation
? DecorationImage(
image: AssetImage(
"assets/drawn/circle.png",
),
fit: BoxFit.fill,
)
: null,
),
child: Stack(
children: [
Align(
alignment: Alignment.center,
child: Container(
width: 400,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
post.effectiveTitle,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
// author credit
Row(
children: [
if (index > 0)
Text(
"#$index",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
Expanded(
child: SizedBox(),
),
Text(
"by ${post.author}",
style: TextStyle(
fontStyle: FontStyle.italic,
),
),
],
),
],
),
),
),
),
),
],
),
),
],
);
}
}
import 'package:flutter/material.dart';
class LeftToRightTransition extends PageRouteBuilder {
final Widget widget;
LeftToRightTransition({@required this.widget})
: super(
transitionDuration: Duration(milliseconds: 500),
pageBuilder: (context, animation, secondaryAnimation) => widget,
transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
Animatable<Offset> tween = Tween(
begin: Offset(-1, 0),
end: Offset.zero,
).chain(
CurveTween(curve: Curves.ease),
);
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
import 'package:flutter/material.dart';
class RightToLeftTransition extends PageRouteBuilder {
final Widget widget;
RightToLeftTransition({@required this.widget})
: super(
transitionDuration: Duration(milliseconds: 500),
pageBuilder: (context, animation, secondaryAnimation) => widget,
transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
Animatable<Offset> tween = Tween(
begin: Offset(1, 0),
end: Offset.zero,
).chain(
CurveTween(curve: Curves.ease),
);
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
);
}
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
class ScrollDetector extends StatelessWidget {
final void Function(PointerScrollEvent event) onPointerScroll;
final Widget child;
const ScrollDetector({
@required this.onPointerScroll,
@required this.child,
});
@override
Widget build(BuildContext context) {
return Listener(
onPointerSignal: (pointerSignal) {
if (pointerSignal is PointerScrollEvent) onPointerScroll(pointerSignal);
},
child: child,
);
}
}
......@@ -173,6 +173,13 @@ packages:
description: flutter
source: sdk
version: "0.9.2+2"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
localstorage:
dependency: "direct main"
description:
......
......@@ -20,6 +20,7 @@ dependencies:
logger: ^0.9.4
localstorage: ^3.0.6
flutter_spinkit: ^5.0.0
intl: ^0.17.0
dev_dependencies:
flutter_test:
......@@ -27,8 +28,8 @@ dev_dependencies:
integration_test:
sdk: flutter
flutter:
assets:
- assets/
- assets/drawn/
uses-material-design: true
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment