mirror of
https://github.com/git-touch/git-touch
synced 2025-02-20 13:30:38 +01:00
fix: styles
This commit is contained in:
parent
c047aae099
commit
9ce9589b2c
@ -58,11 +58,11 @@ class NewsScreenState extends State<NewsScreen> {
|
||||
// return Loading(more: false);
|
||||
if (_events.length == 0) {
|
||||
return Loading(more: false);
|
||||
} else if (index == _events.length) {
|
||||
return Loading(more: true);
|
||||
} else {
|
||||
return EventItem(_events[index]);
|
||||
}
|
||||
if (index == _events.length) {
|
||||
return Loading(more: true);
|
||||
}
|
||||
return EventItem(_events[index]);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -70,23 +70,25 @@ class NewsScreenState extends State<NewsScreen> {
|
||||
switch (SettingsProvider.of(context).layout) {
|
||||
case LayoutMap.cupertino:
|
||||
return CupertinoPageScaffold(
|
||||
child: CustomScrollView(
|
||||
controller: _controller,
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverNavigationBar(largeTitle: const Text('News')),
|
||||
CupertinoSliverRefreshControl(onRefresh: _refresh),
|
||||
SliverSafeArea(
|
||||
top: false,
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(_buildItems,
|
||||
childCount: _events.length + 1),
|
||||
navigationBar: CupertinoNavigationBar(middle: Text('News')),
|
||||
child: SafeArea(
|
||||
child: CustomScrollView(
|
||||
controller: _controller,
|
||||
slivers: <Widget>[
|
||||
CupertinoSliverRefreshControl(onRefresh: _refresh),
|
||||
SliverSafeArea(
|
||||
top: false,
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(_buildItems,
|
||||
childCount: _events.length + 1),
|
||||
),
|
||||
// sliver: SliverList(
|
||||
// delegate:
|
||||
// SliverChildBuilderDelegate(_buildItems, childCount: 1),
|
||||
// ),
|
||||
),
|
||||
// sliver: SliverList(
|
||||
// delegate:
|
||||
// SliverChildBuilderDelegate(_buildItems, childCount: 1),
|
||||
// ),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
default:
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart' hide Notification;
|
||||
import 'package:flutter/cupertino.dart' hide Notification;
|
||||
import '../providers/settings.dart';
|
||||
import '../providers/notification.dart';
|
||||
import '../screens/screens.dart';
|
||||
// import '../screens/screens.dart';
|
||||
import '../widgets/notification_item.dart';
|
||||
import '../widgets/loading.dart';
|
||||
import '../utils/utils.dart';
|
||||
@ -33,26 +33,33 @@ class NotificationScreenState extends State<NotificationScreen> {
|
||||
}
|
||||
|
||||
Widget _buildGroupItem(BuildContext context, int index) {
|
||||
if (loading) {
|
||||
return Loading(more: false);
|
||||
}
|
||||
|
||||
var group = groups[index];
|
||||
|
||||
return Container(
|
||||
// padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10, left: 4, bottom: 4),
|
||||
color: CupertinoColors.extraLightBackgroundGray,
|
||||
child: Text(
|
||||
group.fullName,
|
||||
style: TextStyle(color: CupertinoColors.black),
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.black12)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
color: Colors.black12,
|
||||
child: Text(
|
||||
group.fullName,
|
||||
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: group.items
|
||||
.map((item) => NotificationItem(item: item))
|
||||
.toList())
|
||||
],
|
||||
Column(
|
||||
children: group.items
|
||||
.map((item) => NotificationItem(item: item))
|
||||
.toList())
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -116,24 +123,13 @@ class NotificationScreenState extends State<NotificationScreen> {
|
||||
top: false,
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(BuildContext context, int index) {
|
||||
if (index == groups.length) {
|
||||
return Loading(more: true);
|
||||
} else {
|
||||
return _buildGroupItem(context, index);
|
||||
}
|
||||
},
|
||||
childCount: groups.length + 1,
|
||||
_buildGroupItem,
|
||||
childCount: groups.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
// ListView.builder(
|
||||
// shrinkWrap: true,
|
||||
// itemCount: groups.length,
|
||||
// itemBuilder: _buildGroupItem,
|
||||
// ),
|
||||
);
|
||||
default:
|
||||
return Scaffold(
|
||||
|
@ -1,66 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import '../providers/search.dart';
|
||||
import '../providers/settings.dart';
|
||||
|
||||
class SearchScreen extends StatefulWidget {
|
||||
@override
|
||||
_SearchScreenState createState() => _SearchScreenState();
|
||||
}
|
||||
|
||||
class _SearchScreenState extends State<SearchScreen> {
|
||||
int active = 0;
|
||||
List users = [];
|
||||
|
||||
class SearchScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SearchBloc bloc = SearchProvider.of(context);
|
||||
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CupertinoTextField(
|
||||
placeholder: 'Type to search',
|
||||
onChanged: (String value) {
|
||||
bloc.keywordUpdate.add(value);
|
||||
},
|
||||
onSubmitted: (String value) {
|
||||
bloc.submit.add(value);
|
||||
},
|
||||
switch (SettingsProvider.of(context).layout) {
|
||||
case LayoutMap.cupertino:
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: CupertinoTextField(
|
||||
placeholder: 'Type to search',
|
||||
onChanged: (String value) {
|
||||
//
|
||||
},
|
||||
onSubmitted: (String value) {
|
||||
//
|
||||
},
|
||||
),
|
||||
),
|
||||
CupertinoSegmentedControl(
|
||||
children: {0: Text('Repos'), 1: Text('Users')},
|
||||
onValueChanged: (int value) {
|
||||
bloc.activeUpdate.add(value);
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CupertinoSegmentedControl(
|
||||
children: {0: Text('Repos'), 1: Text('Users')},
|
||||
onValueChanged: (int value) {
|
||||
//
|
||||
},
|
||||
),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: users.length,
|
||||
itemBuilder: (context, index) {
|
||||
var user = users[index];
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Image.network(
|
||||
user['avatarUrl'],
|
||||
),
|
||||
Text(user['login'])
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
StreamBuilder<bool>(
|
||||
stream: bloc.loading,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == null || snapshot.data) {
|
||||
return CupertinoActivityIndicator();
|
||||
}
|
||||
);
|
||||
|
||||
return StreamBuilder(
|
||||
stream: bloc.users,
|
||||
builder: (context, snapshot) {
|
||||
var users = snapshot.data;
|
||||
if (users == null) return Text('');
|
||||
if (users.length == 0) {
|
||||
return Text("No result");
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: users.length,
|
||||
itemBuilder: (context, index) {
|
||||
var user = users[index];
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Image.network(
|
||||
user['avatarUrl'],
|
||||
),
|
||||
Text(user['login'])
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
default:
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Search')),
|
||||
body: ListView.builder(
|
||||
itemCount: users.length,
|
||||
itemBuilder: (context, index) => Text(''),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,11 @@ export 'timeago.dart';
|
||||
TextSpan createLinkSpan(BuildContext context, String text, Function handle) {
|
||||
return TextSpan(
|
||||
text: text,
|
||||
style: TextStyle(color: Color(0xff0366d6)),
|
||||
style: TextStyle(
|
||||
color: Color(0xff0366d6),
|
||||
fontWeight: FontWeight.w600,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Navigator.of(context).push(
|
||||
|
@ -13,9 +13,8 @@ class Avatar extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Link(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(builder: (_) => UserScreen(login)),
|
||||
);
|
||||
Navigator.of(context)
|
||||
.push(CupertinoPageRoute(builder: (_) => UserScreen(login)));
|
||||
},
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.transparent,
|
||||
|
@ -26,7 +26,10 @@ class CommentItem extends StatelessWidget {
|
||||
]),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20, top: 10),
|
||||
child: MarkdownBody(data: item['body']),
|
||||
child: MarkdownBody(
|
||||
data: item['body'],
|
||||
// styleSheet: MarkdownStyleSheet(code: TextStyle(fontSize: 14)),
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../screens/screens.dart';
|
||||
import '../utils/utils.dart';
|
||||
import '../widgets/widgets.dart';
|
||||
@ -82,7 +83,7 @@ class EventItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
String _buildOriginalComment() {
|
||||
String _buildDetail() {
|
||||
switch (event.type) {
|
||||
case 'IssueCommentEvent':
|
||||
return event.payload['comment']['body'];
|
||||
@ -97,27 +98,6 @@ class EventItem extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
String _buildComment() {
|
||||
return _buildOriginalComment();
|
||||
}
|
||||
|
||||
TextSpan _buildLink(BuildContext context, String text, Function handle) {
|
||||
return TextSpan(
|
||||
text: text,
|
||||
style: TextStyle(color: Color(0xff0366d6)),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) {
|
||||
return handle();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
TextSpan _buildRepo(BuildContext context) {
|
||||
String name = event.repo.name;
|
||||
var arr = name.split('/');
|
||||
@ -128,14 +108,14 @@ class EventItem extends StatelessWidget {
|
||||
int id = event.payload['issue']['number'];
|
||||
String name = event.repo.name;
|
||||
var arr = name.split('/');
|
||||
return _buildLink(
|
||||
return createLinkSpan(
|
||||
context, '#' + id.toString(), () => IssueScreen(id, arr[0], arr[1]));
|
||||
}
|
||||
|
||||
TextSpan _buildPullRequest(BuildContext context, int id) {
|
||||
String name = event.repo.name;
|
||||
var arr = name.split('/');
|
||||
return _buildLink(context, '#' + id.toString(),
|
||||
return createLinkSpan(context, '#' + id.toString(),
|
||||
() => PullRequestScreen(id, arr[0], arr[1]));
|
||||
}
|
||||
|
||||
@ -159,46 +139,57 @@ class EventItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
build(context) {
|
||||
return Link(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: CupertinoColors.lightBackgroundGray))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Avatar(event.actor.login, event.actor.avatarUrl),
|
||||
Padding(padding: EdgeInsets.only(left: 10)),
|
||||
Expanded(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(color: Color(0xff24292e), height: 1.2),
|
||||
children: <TextSpan>[
|
||||
_buildLink(context, event.actor.login,
|
||||
() => UserScreen(event.actor.login)),
|
||||
_buildEvent(context),
|
||||
],
|
||||
build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.black12))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Avatar(event.actor.login, event.actor.avatarUrl),
|
||||
Padding(padding: EdgeInsets.only(left: 10)),
|
||||
Expanded(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
height: 1.3,
|
||||
fontSize: 15,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
createLinkSpan(context, event.actor.login,
|
||||
() => UserScreen(event.actor.login)),
|
||||
_buildEvent(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(left: 10)),
|
||||
Icon(_buildIconData(context),
|
||||
color: CupertinoColors.inactiveGray),
|
||||
],
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Icon(
|
||||
_buildIconData(context),
|
||||
color: CupertinoColors.inactiveGray,
|
||||
size: 22,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 46, top: 6),
|
||||
child: Text(
|
||||
_buildDetail(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 15,
|
||||
height: 1.2,
|
||||
fontWeight: FontWeight.w300,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 42, top: 8),
|
||||
child: Text(_buildComment(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: Color(0xffaaaaaa))))
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class _IssuePullRequestScreenState extends State<IssuePullRequestScreen> {
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
if (payload == null) {
|
||||
return Loading();
|
||||
return Loading(more: false);
|
||||
}
|
||||
|
||||
List items = payload['timeline']['nodes'];
|
||||
|
@ -46,48 +46,50 @@ class NotificationItem extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: Colors.black12)),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Icon(
|
||||
_buildIconData(item.subject.type),
|
||||
// color: CupertinoColors.inactiveGray,
|
||||
color: Colors.black45,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
// color: Colors.grey,
|
||||
))),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(item.subject.title,
|
||||
style: TextStyle(height: 1)),
|
||||
Padding(padding: EdgeInsets.only(top: 4)),
|
||||
Text(TimeAgo.format(item.updatedAt),
|
||||
style: TextStyle(fontSize: 12))
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
item.subject.title,
|
||||
style: TextStyle(fontSize: 15),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(top: 8)),
|
||||
Text(
|
||||
TimeAgo.format(item.updatedAt),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.black87,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Icon(
|
||||
Octicons.check,
|
||||
// color: CupertinoColors.inactiveGray,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Icon(Octicons.check, color: Colors.black45),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -65,8 +65,8 @@ class TimelineItem extends StatelessWidget {
|
||||
Widget _buildByType(BuildContext context) {
|
||||
switch (item['__typename']) {
|
||||
case 'IssueComment':
|
||||
return Text('comment');
|
||||
// return CommentItem(item);
|
||||
// return Text('comment');
|
||||
return CommentItem(item);
|
||||
case 'ReferencedEvent':
|
||||
// TODO: isCrossRepository
|
||||
if (item['commit'] == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user