add disable customer function

This commit is contained in:
Sai Naw Wun
2020-10-17 01:40:24 +06:30
parent 13fa1903bc
commit fa9738f307
28 changed files with 196 additions and 205 deletions

View File

@@ -135,7 +135,10 @@ class _FAQEditorState extends State<FAQEditor> {
color: primaryColor, fontSize: 20),
actions: [
IconButton(
icon: Icon(Icons.delete),
icon: Icon(
Icons.delete,
color: primaryColor,
),
onPressed: _delete,
)
],
@@ -176,80 +179,6 @@ class _FAQEditorState extends State<FAQEditor> {
),
),
)));
LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
body: CustomScrollView(slivers: [
SliverAppBar(
leading: IconButton(
icon: Icon(
CupertinoIcons.back,
size: 30,
),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
expandedHeight: 150.0,
floating: true,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
titlePadding: EdgeInsets.symmetric(vertical: 10),
title: LocalText(
context,
_isNew ? 'faq.add.title' : 'faq.edit.title',
fontSize: 20,
color: Colors.white,
)),
actions: [
IconButton(
icon: Icon(Icons.delete),
onPressed: _delete,
)
],
),
SliverList(
delegate: SliverChildListDelegate([
Form(
key: _formKey,
child: Padding(
padding: EdgeInsets.only(left: 24.0, right: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
snBox,
Center(child: itemTitle(context, "faq.edit.eng")),
subItemTitle(context, "faq.edit.question",
iconData: SimpleLineIcons.question),
questionEngBox,
subItemTitle(context, "faq.edit.answer",
iconData: MaterialCommunityIcons.message_reply_text),
answerEngBox,
Divider(),
Center(child: itemTitle(context, "faq.edit.mm")),
subItemTitle(context, "faq.edit.question",
iconData: SimpleLineIcons.question),
questionMmBox,
subItemTitle(context, "faq.edit.answer",
iconData: MaterialCommunityIcons.message_reply_text),
answerMmBox,
Divider(),
Center(child: itemTitle(context, "faq.edit.page")),
pageLinkBox,
pageLabelEngBox,
pageLabelMmBox,
fcsButton(context, getLocalString(context, "btn.save"),
callack: _save),
SizedBox(
height: 20,
)
],
),
),
),
]))
])));
}
_save() async {

View File

@@ -1,8 +1,8 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/data/services/services.dart';
import 'package:fcs/domain/entities/faq.dart';
import 'package:fcs/helpers/firebase_helper.dart';
import 'package:fcs/pages/main/model/base_model.dart';
import 'package:logging/logging.dart';
@@ -38,19 +38,16 @@ class FAQModel extends BaseModel {
Future<void> addFAQ(FAQ faq) async {
await request("/faqs", "POST",
payload: faq.toMap(),
token: await Services.instance.authService.getToken());
payload: faq.toMap(), token: await getToken());
}
Future<void> updateFAQ(FAQ faq) async {
await request("/faqs", "PUT",
payload: faq.toMap(),
token: await Services.instance.authService.getToken());
payload: faq.toMap(), token: await getToken());
}
Future<void> deleteFAQ(FAQ faq) async {
await request("/faqs", "DELETE",
payload: faq.toMap(),
token: await Services.instance.authService.getToken());
payload: faq.toMap(), token: await getToken());
}
}