使用 Python Django RESTFUL API 进行颤振

需要帮助


我已经为我的应用程序中的用户注册编写了一个颤振小部件,还有一个带有 Django RESTFUL API 的 API。如何将 python Django 中的 API 路由/URL 与 flutter 小部件连接或集成?拜托,我需要一个示例代码。我将不胜感激任何帮助。


这是我的注册颤振小部件:


  import 'package:flutter/material.dart';


    class SignUpPage2 extends StatefulWidget {

      @override

     SignUpPage2State createState() => SignUpPage2State();

    }


    class SignUpPage2State extends State<SignUpPage2> { 


    @override

      Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

        centerTitle: true,


        leading:  IconButton(

                  icon: new Icon(Icons.arrow_back, 

                  color:Colors.orange.shade700),

                        onPressed: () { 


                          Navigator.pop(context);


                           },

                    ),


        title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),

        backgroundColor: Colors.black,

      ),

      backgroundColor: Colors.black45,

      body: Center(

        child: ListView(

          shrinkWrap: true,

          padding: EdgeInsets.only(left: 24.0, right: 24.0),

          children: <Widget>[


              new Center(

                child: new Text("Welcome",

                style: new TextStyle(

                  color: Colors.orange.shade700,

                  fontFamily: 'Poppins-Bold',

                  fontSize: 30.0,

                ),

                textAlign: TextAlign.center,

                ),   

            ), 

            SizedBox(height: 10.0),


            new Center(

                child: new Text("Please, Introduce Yourself",

                style: new TextStyle(

                  color: Colors.white,

                  fontFamily: 'Poppins',

                  fontSize: 20.0,

                ),

                textAlign: TextAlign.center,

                ),   

              ),  

            SizedBox(height: 20.0)

守着一只汪
浏览 203回答 2
2回答

青春有我

您需要将http包添加到您的项目中。然后将 http 调用封装到您的 Python REST 端点中Future。我讨厌发布链接作为答案,但在这种情况下,想不出比这个完美回答您的问题的食谱示例更好的方法了!
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python