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:
parent
ae7b1247b4
commit
be1221b741
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:git_touch/models/theme.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:git_touch/widgets/loading.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@ -90,35 +90,7 @@ class ErrorLoadingWrapper extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (error.isNotEmpty) {
|
if (error.isNotEmpty) {
|
||||||
return Container(
|
return ErrorReload(text: error, onTap: reload);
|
||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
@ -7,7 +7,6 @@ import 'package:git_touch/models/notification.dart';
|
|||||||
import 'package:git_touch/models/auth.dart';
|
import 'package:git_touch/models/auth.dart';
|
||||||
import '../widgets/notification_item.dart';
|
import '../widgets/notification_item.dart';
|
||||||
import '../widgets/list_group.dart';
|
import '../widgets/list_group.dart';
|
||||||
import '../widgets/link.dart';
|
|
||||||
import '../widgets/empty.dart';
|
import '../widgets/empty.dart';
|
||||||
import '../utils/utils.dart';
|
import '../utils/utils.dart';
|
||||||
|
|
||||||
@ -109,8 +108,7 @@ $key: pullRequest(number: ${item.number}) {
|
|||||||
repo,
|
repo,
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||||
),
|
),
|
||||||
Link(
|
GestureDetector(
|
||||||
material: false,
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Provider.of<AuthModel>(context)
|
await Provider.of<AuthModel>(context)
|
||||||
.putWithCredentials('/repos/$repo/notifications');
|
.putWithCredentials('/repos/$repo/notifications');
|
||||||
|
@ -34,7 +34,6 @@ class Avatar extends StatelessWidget {
|
|||||||
return Link(
|
return Link(
|
||||||
screenBuilder: (_) => UserScreen(login),
|
screenBuilder: (_) => UserScreen(login),
|
||||||
child: avatar,
|
child: avatar,
|
||||||
material: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'link.dart';
|
|
||||||
|
|
||||||
class ErrorReload extends StatelessWidget {
|
class ErrorReload extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
@ -27,13 +26,12 @@ class ErrorReload extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(padding: EdgeInsets.only(top: 10)),
|
Padding(padding: EdgeInsets.only(top: 10)),
|
||||||
Link(
|
GestureDetector(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reload',
|
'Reload',
|
||||||
style: TextStyle(fontSize: 20, color: Colors.blueAccent),
|
style: TextStyle(fontSize: 20, color: Colors.blueAccent),
|
||||||
),
|
),
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
material: false,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -9,14 +9,12 @@ class Link extends StatelessWidget {
|
|||||||
final String url;
|
final String url;
|
||||||
final WidgetBuilder screenBuilder;
|
final WidgetBuilder screenBuilder;
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
final bool material;
|
|
||||||
|
|
||||||
Link({
|
Link({
|
||||||
this.child,
|
this.child,
|
||||||
this.url,
|
this.url,
|
||||||
this.screenBuilder,
|
this.screenBuilder,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.material = true,
|
|
||||||
}) : assert(screenBuilder == null || url == null);
|
}) : assert(screenBuilder == null || url == null);
|
||||||
|
|
||||||
void _onTap(BuildContext context) {
|
void _onTap(BuildContext context) {
|
||||||
@ -33,13 +31,6 @@ class Link extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!material) {
|
|
||||||
return GestureDetector(
|
|
||||||
child: child,
|
|
||||||
onTap: () => _onTap(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Material(
|
return Material(
|
||||||
child: Ink(
|
child: Ink(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user