Giter VIP home page Giter VIP logo

probstate's Introduction

Fitness Tracker

We will be using scopedModel as the state management tool

There are two main files in which we will write our functions, you will never write any functions in the UI files.

all the functions like login, register, api-post/get, will be written in the file dedicated to them,

the files for writing the functions are (in folder scopedModel)

  1. apiCalls.dart
  2. methods.dart

Don't write anything in mainModel.dart

how to call the methods and functions from the UI events(ontap/onpressed):

whenever you want to access the methods you have to just wrap that widget in scopedModel.

for example:

Widget ExampleWidget(){ return Container( child:RaisedButton( onPressed:(){ // call the function from one of any files in which we wrote them } ) );

}

just wrap that 'return' with scopedModel Widget

return ScopedModelDescendant( builder: (context, child, mainModel) {

	//your Widget's code
	
	}
	);

this ExampleWidget will be just change to:

Widget ExampleWidget(){

return ScopedModelDescendant( builder: (context, child, mainModel) {

return Container(
child:RaisedButton(
onPressed:(){
// call the function from one of any files in which we wrote them
}
)
);


}
);

}

how to call the functions now:

use mainModel as an Object

Widget ExampleWidget(){

return ScopedModelDescendant( builder: (context, child, mainModel) {

return Container(
child:RaisedButton(
onPressed:(){
	mainModel.Function();
}
)
);


}
);

}

Don't forget to import these files .

probstate's People

Contributors

akshaykumaru18 avatar borsezf2 avatar ritikk978 avatar sparshgupta24 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.