mirror of
https://github.com/git-touch/git-touch
synced 2025-02-22 06:17:40 +01:00
fix: widget span for branch name
This commit is contained in:
parent
bc068c20ee
commit
ca11d0f0d5
@ -8,8 +8,7 @@ import 'package:git_touch/screens/user.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
export 'package:flutter_vector_icons/flutter_vector_icons.dart' hide Octicons;
|
export 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
export 'package:primer/primer.dart' show Octicons;
|
|
||||||
|
|
||||||
final monospaceFont = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
final monospaceFont = Platform.isIOS ? 'Menlo' : 'monospace'; // FIXME:
|
||||||
|
|
||||||
@ -164,3 +163,33 @@ String getBranchQueryKey(String branch, {bool withParams = false}) {
|
|||||||
if (branch == null) return 'defaultBranchRef';
|
if (branch == null) return 'defaultBranchRef';
|
||||||
return 'ref' + (withParams ? '(qualifiedName: "$branch")' : '');
|
return 'ref' + (withParams ? '(qualifiedName: "$branch")' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Primer
|
||||||
|
class PrimerBranchName extends StatelessWidget {
|
||||||
|
final String name;
|
||||||
|
|
||||||
|
PrimerBranchName(this.name);
|
||||||
|
|
||||||
|
static const branchBgColor = Color(0xffeaf5ff);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 4),
|
||||||
|
height: 16,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: branchBgColor,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(3)),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: PrimerColors.blue500,
|
||||||
|
fontSize: 12,
|
||||||
|
height: 1,
|
||||||
|
fontFamily: monospaceFont,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -56,7 +56,7 @@ class EventItem extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildItem({
|
Widget _buildItem({
|
||||||
@required BuildContext context,
|
@required BuildContext context,
|
||||||
@required List<TextSpan> spans,
|
@required List<InlineSpan> spans,
|
||||||
String detail,
|
String detail,
|
||||||
Widget detailWidget,
|
Widget detailWidget,
|
||||||
IconData iconData = Octicons.octoface,
|
IconData iconData = Octicons.octoface,
|
||||||
@ -287,22 +287,15 @@ class EventItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case 'PushEvent':
|
case 'PushEvent':
|
||||||
String ref = event.payload['ref'];
|
var ref = event.payload['ref'] as String;
|
||||||
List commits = event.payload['commits'];
|
var commits = event.payload['commits'] as List;
|
||||||
|
|
||||||
return _buildItem(
|
return _buildItem(
|
||||||
context: context,
|
context: context,
|
||||||
spans: [
|
spans: [
|
||||||
TextSpan(text: ' pushed to '),
|
TextSpan(text: ' pushed to '),
|
||||||
// TODO: Use primer widgets
|
WidgetSpan(
|
||||||
TextSpan(
|
child: PrimerBranchName(ref.replaceFirst('refs/heads/', '')),
|
||||||
text: ref.replaceFirst('refs/heads/', ''),
|
|
||||||
style: TextStyle(
|
|
||||||
color: PrimerColors.blue500,
|
|
||||||
fontSize: 14,
|
|
||||||
backgroundColor: Color(0xffeaf5ff),
|
|
||||||
fontFamily: monospaceFont,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
TextSpan(text: ' at '),
|
TextSpan(text: ' at '),
|
||||||
_buildRepo(context)
|
_buildRepo(context)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user