git-touch-android-ios-app/lib/widgets/user_name.dart

35 lines
808 B
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
2019-01-31 07:37:25 +01:00
import '../screens/screens.dart';
import 'link.dart';
final style = TextStyle(fontWeight: FontWeight.w600);
TextSpan createUserSpan(String login) {
return TextSpan(text: login, style: style);
}
class UserName extends StatelessWidget {
final String login;
UserName(this.login);
@override
Widget build(BuildContext context) {
2019-01-31 07:37:25 +01:00
return Link(
onTap: () {
Navigator.of(context).push(
CupertinoPageRoute(builder: (_) => UserScreen(login)),
);
},
child: Container(
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
),
2019-01-31 07:37:25 +01:00
child: Text(login, style: style),
),
);
}
}