Untitled

mail@pastecode.io avatar
unknown
dart
7 months ago
1.2 kB
1
Indexable
Never
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:http/http.dart';


class Home extends StatefulWidget {
  const Home({super.key});

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {

  @override
  void initState() {
    super.initState();
    print("it is a init state");
  }
  @override
  void setState(VoidCallback fn) {
    super.setState(fn);
    print('set state function is called ');
  }
  @override
  void dispose() {
    super.dispose();
    print('Widget colsed');
  }




  @override
  Widget build(BuildContext context) {
    Map info = ModalRoute.of(context)?.settings.arguments as Map;
    //Map<String, dynamic> info = ModalRoute.of(context)!.settings.arguments as Map<String, dynamic >;

    return  Scaffold(
      body: SafeArea(

          child: Column(
            children: [
              Text('Home page'),
              SizedBox(height: 11,),
              ElevatedButton(onPressed: (){
                setState(() {});
              }, child: Text('Click')),

          Text(info["temp_value"])
            ],
          )),
    );
  }
}