import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; import 'package:photos/services/update_service.dart'; import 'package:photos/ui/app_update_dialog.dart'; import 'package:photos/ui/settings/common_settings.dart'; import 'package:photos/ui/settings/settings_section_title.dart'; import 'package:photos/ui/settings/settings_text_item.dart'; import 'package:photos/ui/web_page.dart'; import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/toast_util.dart'; import 'package:url_launcher/url_launcher.dart'; class InfoSectionWidget extends StatelessWidget { const InfoSectionWidget({Key key}) : super(key: key); @override Widget build(BuildContext context) { return ExpandablePanel( header: SettingsSectionTitle("About"), collapsed: Container(), expanded: _getSectionOptions(context), theme: getExpandableTheme(context), ); } Widget _getSectionOptions(BuildContext context) { return Column( children: [ GestureDetector( behavior: HitTestBehavior.translucent, onTap: () async { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) { return WebPage("FAQ", "https://ente.io/faq"); }, ), ); }, child: SettingsTextItem(text: "FAQ", icon: Icons.navigate_next), ), SectionOptionDivider, GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) { return WebPage("terms", "https://ente.io/terms"); }, ), ); }, child: SettingsTextItem(text: "Terms", icon: Icons.navigate_next), ), SectionOptionDivider, GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) { return WebPage("privacy", "https://ente.io/privacy"); }, ), ); }, child: SettingsTextItem(text: "Privacy", icon: Icons.navigate_next), ), SectionOptionDivider, GestureDetector( behavior: HitTestBehavior.translucent, onTap: () async { launch("https://github.com/ente-io/frame"); }, child: SettingsTextItem(text: "Source code", icon: Icons.navigate_next), ), UpdateService.instance.isIndependent() ? Column( children: [ Divider(height: 4), GestureDetector( behavior: HitTestBehavior.translucent, onTap: () async { final dialog = createProgressDialog(context, "checking..."); await dialog.show(); final shouldUpdate = await UpdateService.instance.shouldUpdate(); await dialog.hide(); if (shouldUpdate) { showDialog( context: context, builder: (BuildContext context) { return AppUpdateDialog( UpdateService.instance.getLatestVersionInfo()); }, barrierColor: Colors.black.withOpacity(0.85), ); } else { showToast("you are on the latest version"); } }, child: SettingsTextItem( text: "Check for updates", icon: Icons.navigate_next), ), ], ) : Container(), ], ); } }