1
0
mirror of https://github.com/git-touch/git-touch synced 2025-01-31 08:04:51 +01:00

refactor: remove link material prop

This commit is contained in:
Rongjian Zhang 2019-09-29 16:39:30 +08:00
parent ae7b1247b4
commit be1221b741
5 changed files with 4 additions and 46 deletions

View File

@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/loading.dart';
import 'package:provider/provider.dart';
@ -90,35 +90,7 @@ class ErrorLoadingWrapper extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (error.isNotEmpty) {
return Container(
padding: EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Column(
children: <Widget>[
Text(
'Woops, something bad happened. Error message:',
style: TextStyle(fontSize: 16),
),
Padding(padding: EdgeInsets.only(top: 10)),
Text(
error,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w300,
color: Colors.redAccent,
),
),
Padding(padding: EdgeInsets.only(top: 10)),
Link(
child: Text(
'Reload',
style: TextStyle(fontSize: 20, color: Colors.blueAccent),
),
onTap: reload,
material: false,
),
],
),
);
return ErrorReload(text: error, onTap: reload);
}
if (loading) {

View File

@ -7,7 +7,6 @@ import 'package:git_touch/models/notification.dart';
import 'package:git_touch/models/auth.dart';
import '../widgets/notification_item.dart';
import '../widgets/list_group.dart';
import '../widgets/link.dart';
import '../widgets/empty.dart';
import '../utils/utils.dart';
@ -109,8 +108,7 @@ $key: pullRequest(number: ${item.number}) {
repo,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
Link(
material: false,
GestureDetector(
onTap: () async {
await Provider.of<AuthModel>(context)
.putWithCredentials('/repos/$repo/notifications');

View File

@ -34,7 +34,6 @@ class Avatar extends StatelessWidget {
return Link(
screenBuilder: (_) => UserScreen(login),
child: avatar,
material: false,
);
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'link.dart';
class ErrorReload extends StatelessWidget {
final String text;
@ -27,13 +26,12 @@ class ErrorReload extends StatelessWidget {
),
),
Padding(padding: EdgeInsets.only(top: 10)),
Link(
GestureDetector(
child: Text(
'Reload',
style: TextStyle(fontSize: 20, color: Colors.blueAccent),
),
onTap: onTap,
material: false,
),
],
),

View File

@ -9,14 +9,12 @@ class Link extends StatelessWidget {
final String url;
final WidgetBuilder screenBuilder;
final Function onTap;
final bool material;
Link({
this.child,
this.url,
this.screenBuilder,
this.onTap,
this.material = true,
}) : assert(screenBuilder == null || url == null);
void _onTap(BuildContext context) {
@ -33,13 +31,6 @@ class Link extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (!material) {
return GestureDetector(
child: child,
onTap: () => _onTap(context),
);
}
return Material(
child: Ink(
color: Colors.white,