Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatefulWidget {
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- var usernameCtr = TextEditingController();
- var passwordCtr = TextEditingController();
- int angka;
- @override
- void initState() {
- super.initState();
- angka = int.parse(usernameCtr.text) + int.parse(passwordCtr.text);
- }
- Widget build(BuildContext context) {
- return MaterialApp(
- home: SafeArea(
- child: Scaffold(
- body: SingleChildScrollView(
- child: Column(children: <Widget>[
- TextFormField(
- controller: usernameCtr,
- decoration: InputDecoration(labelText: "Username"),
- ),
- TextFormField(
- controller: passwordCtr,
- decoration: InputDecoration(labelText: "Password"),
- keyboardType: TextInputType.number,
- ),
- const SizedBox(height: 30),
- InkWell(
- child: Container(
- width: 30,
- height: 30,
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [Color(4279757529), Color(0xFF6078ea)]),
- borderRadius: BorderRadius.circular(6.0),
- boxShadow: [
- BoxShadow(
- color: Color(0xFF6078ea).withOpacity(.3),
- offset: Offset(0.0, 8.0),
- blurRadius: 8.0)
- ]),
- child: Material(
- color: Colors.transparent,
- child: InkWell(
- onTap: () {
- print(angka);
- //teks=passwordCtr.text;
- setState(() {});
- },
- child: Center(
- child: Text("+",
- style: TextStyle(
- color: Colors.white,
- fontSize: 18,
- letterSpacing: 1.0)),
- ),
- ),
- ),
- ),
- ),
- Text(angka.toString())
- ]),
- ),
- )),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement