tddc73 lecture 3
play

TDDC73 Lecture 3 1 Agenda Questions Complex components - PowerPoint PPT Presentation

TDDC73 Lecture 3 1 Agenda Questions Complex components Network REST and/or GraphQL Screen navigation 2 Organisation of code Biggest challenge of UI development (Ok one of ) Maintaining the


  1. TDDC73 Lecture 3 � 1

  2. Agenda • Questions • Complex components • Network • REST and/or GraphQL • Screen navigation � 2

  3. Organisation of code • Biggest challenge of UI development (Ok one of ) • Maintaining the correct and same state between the UI and the system/model/backend • Separation of concerns • Architecture Presentation Patterns • MVC • MVP • MVVM � 3

  4. � 4 Model-View-Presenter MVP

  5. Demo • Android Adapter � 5

  6. Network • REST � 6

  7. DEMO old school � 7

  8. Network • GraphQL • Putting REST to rest � 8

  9. GraphQL • A query language for back-ends • Front-end driven • You decide what you want • Subway vs Pressbyrån • Singel endpoint • Typed � 9

  10. Navigation � 10

  11. Flutter • Routes • Pages/Screens • Navigation • To move between Routes • Push and Pop • Hero • Animation between Routes � 11

  12. Routes class SecondRoute extends StatelessWidget { class FirstRoute extends StatelessWidget { @override @override Widget build(BuildContext context) { Widget build(BuildContext context) { return Scaffold( return Scaffold( appBar: AppBar( appBar: AppBar( title: Text("Second Route"), title: Text('First Route'), ), ), body: Center( body: Center( child: RaisedButton(¨ child: RaisedButton( child: Text('Go back!'), child: Text('Open route'), ), }, ), ), ); ), } ); } } } � 12

  13. Navigation child: RaisedButton( child: Text('Open route'), onPressed: () { child: RaisedButton( Navigator.push( onPressed: () { context, Navigator.pop(context); MaterialPageRoute(builder: (context) }, => SecondRoute()), child: Text('Go back!'), ); ), }, ), routes: { '/': (context) => FirstScreen(), '/info': (context) => SecondRoute(), }, Navigator.pushNamed(context, ‘/info'); � 13

  14. Hero Hero( tag: 'imageHero', child: Image.network( 'https://picsum.photos/250?image=9', ), ); � 14

  15. React-Native • Screens • Routes describes Screens • Offers a few options • StackNaviagator (Similar to Flutter) const MainNavigator = createStackNavigator({ Home: {screen: HomeScreen}, Profile: {screen: ProfileScreen}, }); � 15

  16. Screen (Just a component) class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { const {navigate} = this.props.navigation; return ( <Button title="Go to Anders's profile" onPress={() => navigate('Profile', {name: ‘Anders'})} /> ); } createStackNavigator( { Home: HomeScreen, Profile: DetailsScreen, }, { initialRouteName: 'Home', } ); � 16

  17. Push,navigate,Back <Button title="Go to Details... again" onPress={() => this.props.navigation.push('Details')} /> <Button title="Go to Home" onPress={() => this.props.navigation.navigate('Home')} /> <Button title="Go back" onPress={() => this.props.navigation.goBack()} /> � 17

  18. Standard Android • Basic • Activities • Fragments (deprecated) • Navigator (like flutter and react) in googles Architecture pattern/ solution � 18

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend