Skip to content
Flutter example project.
Dart Objective-C Java
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android
ios
lib
test
.gitignore
.metadata
README.md
pubspec.yaml

README.md

Tip

Creating a cross-platform app is easy!

  void main() => runApp(TipCalculator());

Declare some animation to make it look cool.

  @override void initState() {
    super.initState();
    animationController = AnimationController(duration: Duration(milliseconds: 250), vsync: this);
    animation = Tween(begin: 0.0, end: 1.0).animate(animationController);
  }

  dispose() {
    animationController.dispose();
    super.dispose();
  }

Create a text entry space for tip amounts.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        key: scaffoldKey,
        appBar: AppBar(
          title: Text( "Tip Calculator"),
        ),
        body: Align( alignment: Alignment.lerp(Alignment.topCenter, null, 0.5), child: Stack(
          fit: StackFit.loose,
          alignment: AlignmentDirectional.center,
          children: <Widget>[
            SuggestionRow(animation, false),
            SuggestionRow(animation, true),
            BillCenter(animation, bill, animationStatus, animationController, textController)
          ], ), ));
   }

Animate suggestions into view using the animation!

  @override
  Widget build(BuildContext context) {
    return InkWell(
        onTap: () {},
        child: Transform.scale(
          scale: animation.value,
          child: Transform.translate(offset: Offset(0, isBottom ? -85 : 85), child: Row(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Spacer(flex: 2),
              isBottom ? buttonWith(0.05) : buttonWith(0.25),
              Spacer(flex: 1),
              isBottom ? buttonWith(0.1) : buttonWith(0.3),
              Spacer(flex: 1),
              isBottom ? buttonWith(0.15) : buttonWith(0.35),
              Spacer(flex: 1),
              isBottom ? buttonWith(0.2) : buttonWith(0.4),
              Spacer(flex: 2)
            ],
          ))
        )
    );
  }
You can’t perform that action at this time.