125 lines
4.3 KiB
Dart
125 lines
4.3 KiB
Dart
|
|
import 'package:fcs/fcs/common/domain/entities/faq.dart';
|
||
|
|
import 'package:fcs/fcs/common/domain/entities/setting.dart';
|
||
|
|
import 'package:fcs/fcs/common/domain/vo/contact.dart';
|
||
|
|
import 'package:fcs/fcs/common/helpers/theme.dart';
|
||
|
|
import 'package:fcs/fcs/common/localization/app_translations.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/contact/contact_editor.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/contact/widgets.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/faq/faq_detail_page.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/faq/faq_edit_page.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/model/language_model.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/model/main_model.dart';
|
||
|
|
import 'package:fcs/fcs/common/pages/widgets/local_text.dart';
|
||
|
|
import 'package:fcs/widget/local_text.dart';
|
||
|
|
import 'package:flutter/cupertino.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||
|
|
import 'package:package_info/package_info.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
import 'package:url_launcher/url_launcher.dart';
|
||
|
|
|
||
|
|
class FAQPage extends StatefulWidget {
|
||
|
|
@override
|
||
|
|
_FAQPageState createState() => _FAQPageState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _FAQPageState extends State<FAQPage> {
|
||
|
|
List<FAQ> faqs = [];
|
||
|
|
@override
|
||
|
|
void initState() {
|
||
|
|
super.initState();
|
||
|
|
faqs = [
|
||
|
|
FAQ(questionEng: "Question 1?", answerEng: "Answer 1."),
|
||
|
|
FAQ(questionEng: "Question 2?", answerEng: "Answer 2."),
|
||
|
|
FAQ(questionEng: "Question 3?", answerEng: "Answer 3."),
|
||
|
|
FAQ(questionEng: "Question 4?", answerEng: "Answer 4."),
|
||
|
|
FAQ(questionEng: "Question 5?", answerEng: "Answer 5.")
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
Setting setting = Provider.of<MainModel>(context).setting;
|
||
|
|
return Scaffold(
|
||
|
|
body: NestedScrollView(
|
||
|
|
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||
|
|
return <Widget>[
|
||
|
|
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: Text(AppTranslations.of(context).text('faq.title'),
|
||
|
|
style: TextStyle(
|
||
|
|
color: Colors.white,
|
||
|
|
)),
|
||
|
|
),
|
||
|
|
actions: [
|
||
|
|
IconButton(
|
||
|
|
onPressed: () =>
|
||
|
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
||
|
|
builder: (context) => FAQEditor(),
|
||
|
|
)),
|
||
|
|
icon: Icon(
|
||
|
|
CupertinoIcons.add,
|
||
|
|
color: Colors.white,
|
||
|
|
size: 35,
|
||
|
|
))
|
||
|
|
],
|
||
|
|
),
|
||
|
|
];
|
||
|
|
},
|
||
|
|
body: Padding(
|
||
|
|
padding: const EdgeInsets.only(left: 18.0, right: 18),
|
||
|
|
child: ListView.separated(
|
||
|
|
separatorBuilder: (_, i) => Divider(),
|
||
|
|
itemCount: faqs.length,
|
||
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
||
|
|
return _faqItem(context, faqs[index]);
|
||
|
|
}),
|
||
|
|
)),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Widget _faqItem(BuildContext context, FAQ faq) {
|
||
|
|
bool isEng = Provider.of<LanguageModel>(context).isEng;
|
||
|
|
return InkWell(
|
||
|
|
onTap: () {
|
||
|
|
Navigator.of(context).push(CupertinoPageRoute(
|
||
|
|
builder: (context) => FAQDetailPage(
|
||
|
|
faq: faq,
|
||
|
|
),
|
||
|
|
));
|
||
|
|
},
|
||
|
|
child: Container(
|
||
|
|
padding: EdgeInsets.all(15),
|
||
|
|
child: Row(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
TextLocalStyle(
|
||
|
|
context,
|
||
|
|
faq.question(isEng),
|
||
|
|
fontSize: 16,
|
||
|
|
),
|
||
|
|
Spacer(),
|
||
|
|
Icon(
|
||
|
|
CupertinoIcons.right_chevron,
|
||
|
|
color: primaryColor,
|
||
|
|
size: 22,
|
||
|
|
)
|
||
|
|
],
|
||
|
|
)),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|