123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- class Remarks extends StatelessWidget {
- final String friendId;
- final String remarks;
- final _controller = TextEditingController();
- Remarks({Key key, this.friendId, this.remarks}) : super(key: key) {
- _controller.text = remarks ?? '';
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: MyAppBar(
- centerTitle: "设置备注名",
- ),
- body: Container(
- padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
- child: Column(
- children: [
- Container(
- color: Color(0xfff6f6f6),
- height: 45,
- child: TextField(
- style: TextStyle(
- color: Color(0xff333333),
- fontSize: 16,
- ),
- controller: _controller,
- decoration: InputDecoration(
- border: InputBorder.none,
- contentPadding: EdgeInsets.symmetric(horizontal: 5),
- ),
- ),
- ),
- Spacer(),
- GestureDetector(
- onTap: () {
- NewApiService().setRemarksForFriend(
- targetUserId: int.tryParse(friendId),
- remarks: _controller.text,
- onSuccess: (res) {
- Navigator.pop(context, _controller.text);
- },
- onError: (code, msg) {
- toasts('$msg');
- });
- },
- child: Container(
- alignment: Alignment.center,
- height: 45,
- width: double.infinity,
- decoration: BoxDecoration(
- color: Color(0xff5589FF),
- borderRadius: BorderRadius.circular(20),
- ),
- child: Text(
- '保存',
- style: TextStyle(color: Colors.white, fontSize: 16),
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
|