mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-28 18:39:26 -05:00
feat: extract provider, add android news screen
This commit is contained in:
@@ -1,8 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:git_flux/screens/screens.dart';
|
||||
export 'github.dart';
|
||||
export 'octicons.dart';
|
||||
export 'timeago.dart';
|
||||
|
||||
TextSpan createLinkSpan(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 createRepoLinkSpan(BuildContext context, String owner, String name) {
|
||||
return createLinkSpan(context, '$owner/$name', () => RepoScreen(owner, name));
|
||||
}
|
||||
|
||||
List<BottomNavigationBarItem> buildNavigationItems() => [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.rss_feed),
|
||||
title: Text('News'),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: StreamBuilder<int>(builder: (context, snapshot) {
|
||||
int count = snapshot.data;
|
||||
print(count);
|
||||
|
||||
// https://stackoverflow.com/a/45434404
|
||||
if (count != null && count > 0) {
|
||||
return Stack(children: <Widget>[
|
||||
Icon(Icons.notifications),
|
||||
Positioned(
|
||||
// draw a red marble
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: Icon(Icons.brightness_1,
|
||||
size: 8.0, color: Colors.redAccent),
|
||||
)
|
||||
]);
|
||||
} else {
|
||||
return Icon(Icons.notifications);
|
||||
}
|
||||
}),
|
||||
title: Text('Notification'),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.search),
|
||||
title: Text('Search'),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
title: Text('Me'),
|
||||
),
|
||||
];
|
||||
|
||||
class Palette {
|
||||
static const green = 0xff2cbe4e;
|
||||
static const purple = 0xff6f42c1;
|
||||
|
||||
Reference in New Issue
Block a user