Created
July 29, 2020 14:23
-
-
Save lucas404x/4352caa6bbef86df98bef8571fca5d9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_mobx/flutter_mobx.dart'; | |
import 'package:flutter_modular/flutter_modular.dart'; | |
import '../../shared/widgets/profile_button/profile_button.dart'; | |
import '../../shared/widgets/repository_card/repository_card.dart'; | |
import 'home_controller.dart'; | |
class HomePage extends StatefulWidget { | |
@override | |
_HomePageState createState() => _HomePageState(); | |
} | |
class _HomePageState extends ModularState<HomePage, HomeController> { | |
@override | |
Widget build(BuildContext context) { | |
Size size = MediaQuery.of(context).size; | |
return Scaffold( | |
appBar: AppBar( | |
actions: <Widget>[ | |
ProfileButton( | |
userModel: this.controller.userData, | |
size: size.width * .13, | |
onTap: () => Modular.to.pushNamed('/user'), | |
) | |
], | |
backgroundColor: Colors.black, | |
title: Text(this.controller.userData.login), | |
centerTitle: true, | |
), | |
body: Observer( | |
builder: (_) { | |
return ListView.builder( | |
controller: this.controller.scroll$, | |
itemBuilder: (context, index) => Padding( | |
padding: EdgeInsets.all(25), | |
child: RepositoryCard( | |
onTap: () => Modular.to.pushNamed('/repository', | |
arguments: | |
this.controller.observableRepositoryList[index]), | |
repositoryModel: | |
this.controller.observableRepositoryList[index]), | |
), | |
itemCount: this.controller.observableRepositoryList.length, | |
); | |
}, | |
), | |
); | |
} | |
@override | |
void dispose() { | |
this.controller.scroll$.dispose(); | |
super.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment