使用Python Django RESTFUL API进行颤振
需要帮助 我已经为我的应用程序编写了一个颤振小部件,供用户在我的应用程序中注册,还编写了一个带有Django RESTFUL API的API。如何将python Django中的API路由/URL与颤振小部件连接或集成?请,我需要一个示例代码。我将感谢任何帮助 这是我的注册颤振小部件:使用Python Django RESTFUL API进行颤振,python,django,dart,flutter,Python,Django,Dart,Flutter,需要帮助 我已经为我的应用程序编写了一个颤振小部件,供用户在我的应用程序中注册,还编写了一个带有Django RESTFUL API的API。如何将python Django中的API路由/URL与颤振小部件连接或集成?请,我需要一个示例代码。我将感谢任何帮助 这是我的注册颤振小部件: import 'package:flutter/material.dart'; class SignUpPage2 extends StatefulWidget { @override
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),
TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'First Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),
TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'Last Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),
TextField(
keyboardType: TextInputType.phone,
autofocus: false,
decoration: InputDecoration(
hintText: 'Phone',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),
TextField(
keyboardType: TextInputType.datetime,
autofocus: false,
decoration: InputDecoration(
hintText: 'Date of Birth',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),
TextField(
keyboardType: TextInputType.text,
autofocus: false,
obscureText: true,
// initialValue: 'john@gmail.com',
decoration: InputDecoration(
hintText: 'Password',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),
Padding(
padding: EdgeInsets.symmetric(
vertical: 16.0),
child: Material(
borderRadius: BorderRadius.circular(30.0),
// shadowColor: Colors.orange.shade700,
// elevation: 5.0,
child: MaterialButton(
minWidth: 200.0,
height: 60.0,
onPressed: (){
setState(() {
Navigator.of(context).pushNamed('/SignUpPage3');
} ,
color: Colors.orange.shade700,
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 23.0,
),
),
),
),
),
]
),
),
);
}}
导入“包装:颤振/材料.省道”;
类SignUpPage2扩展StatefulWidget{
@凌驾
SignUpPage2State createState()=>SignUpPage2State();
}
类SignUpPage2State扩展状态{
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
标题:对,
领先:IconButton(
图标:新图标(Icons.arrow\u back,
颜色:颜色。橙色。阴影700),
onPressed:(){
Navigator.pop(上下文);
},
),
标题:文本(“创建帐户”,样式:TextStyle(颜色:Colors.orange.shade700)),
背景颜色:Colors.black,
),
背景颜色:Colors.black45,
正文:中(
子:ListView(
收缩膜:对,
填充:仅限边设置(左:24.0,右:24.0),
儿童:[
新中心(
儿童:新文本(“欢迎”,
样式:新文本样式(
颜色:Colors.orange.shade700,
fontFamily:“波平斯黑体”,
字体大小:30.0,
),
textAlign:textAlign.center,
),
),
尺寸箱(高度:10.0),
新中心(
孩子:新文本(“请自我介绍”,
样式:新文本样式(
颜色:颜色,白色,
fontFamily:“罂粟花”,
字体大小:20.0,
),
textAlign:textAlign.center,
),
),
尺寸箱(高度:20.0),
文本字段(
键盘类型:TextInputType.text,
自动对焦:错误,
装饰:输入装饰(
hintText:'名字',
是的,
fillColor:Colors.white,
内容填充:来自LTRB(20.0,10.0,20.0,10.0)的EdgeInsets,
边框:大纲输入边框(
边界半径:边界半径。圆形(32.0),
),
),
),
尺寸箱(高度:15.0),
文本字段(
键盘类型:TextInputType.text,
自动对焦:错误,
装饰:输入装饰(
hintText:'姓',
是的,
fillColor:Colors.white,
内容填充:来自LTRB(20.0,10.0,20.0,10.0)的EdgeInsets,
边框:大纲输入边框(
边界半径:边界半径。圆形(32.0),
),
),
),
尺寸箱(高度:15.0),
文本字段(
键盘类型:TextInputType.phone,
自动对焦:错误,
装饰:输入装饰(
hintText:'电话',
是的,
fillColor:Colors.white,
内容填充:来自LTRB(20.0,10.0,20.0,10.0)的EdgeInsets,
边框:大纲输入边框(
边界半径:边界半径。圆形(32.0),
),
),
),
尺寸箱(高度:15.0),
文本字段(
键盘类型:TextInputType.datetime,
自动对焦:错误,
装饰:输入装饰(
hintText:‘出生日期’,
是的,
fillColor:Colors.white,
内容填充:来自LTRB(20.0,10.0,20.0,10.0)的EdgeInsets,
边框:大纲输入边框(
边界半径:边界半径。圆形(32.0),
),
),
),
尺寸箱(高度:15.0),
文本字段(
键盘类型:TextInputType.text,
自动对焦:错误,
蒙昧文字:对,
//初始值:'john@gmail.com',
装饰:输入装饰(
hintText:'密码',
是的,
fillColor:Colors.white,
内容填充:来自LTRB(20.0,10.0,20.0,10.0)的EdgeInsets,
边框:大纲输入边框(
边界半径:边界半径。圆形(32.0),
),
),
),
尺寸箱(高度:15.0),
填充物(
填充:EdgeInsets.symmetric(
垂直线:16.0),
儿童:材料(
边界半径:边界半径。圆形(30.0),
//阴影颜色:Colors.orange.shade700,
//标高:5.0,
子:材质按钮(
最小宽度:200.0,
身高:60.0,
已按下:(){
设置状态(){
Navigator.of(context.pushNamed('/SignUpPage3');
} ,
颜色:Colors.orange.shade700,
子:文本(
“下一步”,
样式:TextStyle(