安卓使用flutter开发

介绍

flutter用的是用的原生c++,界面用OpenGL,速度不差,但是dark语言让我眼花缭乱

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title),),
      body: Center(
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[//控件

          Card(
              // color: Colors.blue[50],
              clipBehavior: Clip.antiAlias,
              margin:EdgeInsets.all(20),
              elevation: 10,
              child: Container(margin:EdgeInsets.all(20),child: Column(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
                Text('$result')
              ],),
          ))
        ],
        ),
      ),
      floatingActionButton: FloatingActionButton(onPressed: _incrementCounter, tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }

写界面用代码,不过点击直接给标志就是,和web差不多

 

 看到这里的符号没有,我只能说java转flutter会很难受,这是自己做的获取网易云热评

 

 

Future<void> _incrementCounter() async {

    //showAboutDialog(context: context, applicationName: 'ShowAboutDialog',applicationVersion: '1.0.0');
    setState(() async {
      //await audioPlayer.resume();
      counter++;
      Dio dio = new Dio();
      ///请求地址 获取用户列表
      String url = "https://api.uomg.com/api/comments.163?format=json";
      ///发起get请求

      Response response = await dio.get(url);
      ///响应数据
      var data = response.data;
      setState(() {
        result = data.toString();
      });
      //json=Get().getRequestFunction1();
    });
  }

这是点击事件,异步很漂亮,但是这个软件布局的写法真的太不行

界面好像是动态的

 

 他直接用php的变量就可以

 

posted @ 2022-10-26 14:58  Z_Chan  阅读(457)  评论(0编辑  收藏  举报