mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
feat: news screen style
This commit is contained in:
parent
58ee48527f
commit
321ab0a60a
@ -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';
|
||||
@ -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]);
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
@ -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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -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 '),
|
||||
|
Loading…
x
Reference in New Issue
Block a user