Skip to content

Commit

Permalink
feat: news screen style
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Sep 7, 2019
1 parent 58ee485 commit 321ab0a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 54 deletions.
7 changes: 2 additions & 5 deletions lib/scaffolds/list.dart
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import '../widgets/error_reload.dart';
import '../widgets/loading.dart';
Expand Down Expand Up @@ -138,11 +139,7 @@ class _ListScaffoldState<T, K> extends State<ListScaffold<T, K>> {
}

if (index % 2 == 1) {
return Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.black12)),
),
);
return BorderView(height: 1);
}

return widget.itemBuilder(items[index ~/ 2]);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.dart
Expand Up @@ -37,7 +37,7 @@ void nextTick(Function callback, [int milliseconds = 0]) {
TextSpan createLinkSpan(BuildContext context, String text, Function handle) {
return TextSpan(
text: text,
style: TextStyle(fontWeight: FontWeight.w600),
style: TextStyle(color: PrimerColors.blue500, fontWeight: FontWeight.w500),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context).push(
Expand Down
93 changes: 45 additions & 48 deletions lib/widgets/event_item.dart
Expand Up @@ -60,17 +60,9 @@ class EventItem extends StatelessWidget {
IconData iconData = Octicons.octoface,
WidgetBuilder screenBuilder,
}) {
if (detailWidget == null) {
if (detail == null) {
detailWidget = Container(); // TODO: placeholder
} else {
detailWidget = Text(
detail,
overflow: TextOverflow.ellipsis,
maxLines: 5,
style: TextStyle(color: PrimerColors.gray600, fontSize: 14),
);
}
if (detailWidget == null && detail != null) {
detailWidget =
Text(detail.trim(), overflow: TextOverflow.ellipsis, maxLines: 5);
}

return Link(
Expand All @@ -80,52 +72,56 @@ class EventItem extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(width: 20),
Icon(iconData, color: PrimerColors.gray400, size: 13),
SizedBox(width: 6),
Text(timeago.format(event.createdAt),
style: TextStyle(fontSize: 13, color: PrimerColors.gray400))
],
),
SizedBox(height: 6),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Avatar(
url: event.actorAvatarUrl,
login: event.actorLogin,
size: 16),
SizedBox(width: 8),
url: event.actorAvatarUrl,
login: event.actorLogin,
size: 18,
),
SizedBox(width: 10),
Expanded(
child: RichText(
text: TextSpan(
style: TextStyle(
fontSize: 15,
color: PrimerColors.gray900,
),
children: [
createLinkSpan(
context,
event.actorLogin,
() => UserScreen(event.actorLogin),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: join(SizedBox(height: 6), [
RichText(
text: TextSpan(
style: TextStyle(
fontSize: 15, color: PrimerColors.gray900),
children: [
createLinkSpan(
context,
event.actorLogin,
() => UserScreen(event.actorLogin),
),
...spans,
],
),
...spans,
// TextSpan(
// text: timeago.format(event.createdAt),
// style: TextStyle(
// fontSize: 13, color: PrimerColors.gray400))
],
),
),
...(detailWidget == null
? []
: [
DefaultTextStyle(
style: TextStyle(
color: PrimerColors.gray500, fontSize: 14),
child: detailWidget,
)
]),
Row(
children: <Widget>[
Icon(iconData, color: PrimerColors.gray700, size: 13),
SizedBox(width: 4),
Text(timeago.format(event.createdAt),
style: TextStyle(
fontSize: 13, color: PrimerColors.gray700))
],
),
]),
),
),
],
),
Container(
padding: EdgeInsets.only(left: 40, top: 6),
child: detailWidget,
),
],
),
),
Expand Down Expand Up @@ -293,8 +289,9 @@ class EventItem extends StatelessWidget {
text: ref.replaceFirst('refs/heads/', ''),
style: TextStyle(
color: PrimerColors.blue500,
fontSize: 14,
backgroundColor: Color(0xffeaf5ff),
fontFamily: 'Menlo',
fontFamily: 'Menlo', // FIXME:
),
),
TextSpan(text: ' at '),
Expand Down

0 comments on commit 321ab0a

Please sign in to comment.