mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
refactor: user screen
This commit is contained in:
parent
df485edcd4
commit
4ab0e4fb75
@ -3,13 +3,13 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/settings.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/screens/repo.dart';
|
||||
import 'package:git_touch/screens/user.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/models/notification.dart';
|
||||
import 'screens/news.dart';
|
||||
import 'screens/notifications.dart';
|
||||
import 'screens/search.dart';
|
||||
import 'screens/me.dart';
|
||||
import 'screens/login.dart';
|
||||
import 'screens/issue.dart';
|
||||
import 'screens/repos.dart';
|
||||
@ -109,7 +109,10 @@ class _HomeState extends State<Home> {
|
||||
case 3:
|
||||
return SearchScreen();
|
||||
case 4:
|
||||
return MeScreen();
|
||||
return UserScreen(
|
||||
Provider.of<SettingsModel>(context).activeLogin,
|
||||
isMe: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/models/settings.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../screens/user.dart';
|
||||
|
||||
class MeScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return UserScreen(
|
||||
Provider.of<SettingsModel>(context).activeLogin,
|
||||
showSettings: true,
|
||||
);
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ import '../utils/utils.dart';
|
||||
|
||||
class UserScreen extends StatelessWidget {
|
||||
final String login;
|
||||
final bool showSettings;
|
||||
final bool isMe;
|
||||
|
||||
UserScreen(this.login, {this.showSettings = false});
|
||||
UserScreen(this.login, {this.isMe = false});
|
||||
|
||||
Future query(BuildContext context) async {
|
||||
var data = await Provider.of<SettingsModel>(context).query('''
|
||||
@ -162,7 +162,7 @@ class UserScreen extends StatelessWidget {
|
||||
title: AppBarTitle('User'),
|
||||
trailingBuilder: (data) {
|
||||
var payload = data[0];
|
||||
if (showSettings) {
|
||||
if (isMe) {
|
||||
return Link(
|
||||
child: Icon(Icons.settings, size: 24),
|
||||
screenBuilder: (_) => SettingsScreen(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user