1
0
mirror of https://github.com/git-touch/git-touch synced 2025-02-12 09:30:38 +01:00
2019-12-27 10:24:15 +08:00

37 lines
849 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';
import 'package:git_touch/models/theme.dart';
class Link extends StatelessWidget {
final Widget child;
final String url;
final Function onTap;
Link({
this.child,
this.url,
this.onTap,
});
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeModel>(context);
return Material(
child: Ink(
color: CupertinoTheme.of(context).scaffoldBackgroundColor,
child: InkWell(
child: child,
splashColor:
theme.theme == AppThemeType.cupertino ? Colors.transparent : null,
onTap: () async {
if (onTap != null) onTap();
theme.push(context, url);
},
),
),
);
}
}