diff --git a/lib/home/about.dart b/lib/home/about.dart index 8165b87..d28b4c4 100644 --- a/lib/home/about.dart +++ b/lib/home/about.dart @@ -7,7 +7,29 @@ import '../util/extension_helper.dart'; const String version = '0.4.19'; -class AboutApp extends StatelessWidget { +class AboutApp extends StatefulWidget { + @override + _AboutAppState createState() => _AboutAppState(); +} + +class _AboutAppState extends State { + ScrollController _scrollController; + bool _scroll; + @override + void initState() { + super.initState(); + _scroll = false; + _scrollController = ScrollController() + ..addListener(() { + if (_scrollController.offset > 0 && !_scroll && mounted) { + setState(() => _scroll = true); + } + if (_scrollController.offset <= 0 && _scroll && mounted) { + setState(() => _scroll = false); + } + }); + } + Widget _listItem( BuildContext context, String text, IconData icons, String url) => InkWell( @@ -34,6 +56,7 @@ class AboutApp extends StatelessWidget { ), ), ); + Widget _translatorInfo(BuildContext context, {String name, String flag}) => Container( height: 50.0, @@ -103,219 +126,231 @@ class AboutApp extends StatelessWidget { backgroundColor: Theme.of(context).primaryColor, appBar: AppBar( title: Text(s.homeToprightMenuAbout), + elevation: _scroll ? 1 : 0, ), body: SafeArea( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - height: 110.0, - alignment: Alignment.center, - child: Column( + child: ScrollConfiguration( + behavior: NoGrowBehavior(), + child: SingleChildScrollView( + controller: _scrollController, + scrollDirection: Axis.vertical, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + height: 110.0, + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Image( + image: AssetImage('assets/logo.png'), + height: 80, + ), + Text(s.version(version)), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(20), + child: Text( + 'Tsacdop is a podcast player built with flutter, a clean, simply beautiful and friendly app.', + textAlign: TextAlign.center, + ), + ), + Row( mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Image( - image: AssetImage('assets/logo.png'), - height: 80, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + TextButton( + onPressed: () => + 'https://tsacdop.stonegate.me/#/privacy' + .launchUrl, + style: TextButton.styleFrom( + primary: context.accentColor, + textStyle: + TextStyle(fontWeight: FontWeight.bold)), + child: Text( + s.privacyPolicy, + ), + ), + Container( + margin: const EdgeInsets.symmetric(horizontal: 5), + height: 4, + width: 4, + decoration: BoxDecoration( + color: context.accentColor, + shape: BoxShape.circle), + ), + TextButton( + onPressed: () => + 'https://tsacdop.stonegate.me/#/changelog' + .launchUrl, + style: TextButton.styleFrom( + primary: context.accentColor, + textStyle: + TextStyle(fontWeight: FontWeight.bold)), + child: Text(s.changelog, + style: TextStyle(color: context.accentColor)), ), - Text(s.version(version)), ], ), - ), - Padding( - padding: const EdgeInsets.all(20), - child: Text( - 'Tsacdop is a podcast player built with flutter, a clean, simply beautiful and friendly app.', - textAlign: TextAlign.center, + Padding( + padding: EdgeInsets.all(10.0), ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - FlatButton( - onPressed: () => - 'https://tsacdop.stonegate.me/#/privacy'.launchUrl, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5)), - child: Text(s.privacyPolicy, - style: TextStyle(color: context.accentColor)), + Container( + padding: EdgeInsets.only(top: 20.0, bottom: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10)), + border: Border.all( + color: Theme.of(context).accentColor, width: 1), ), - Container( - margin: const EdgeInsets.symmetric(horizontal: 5), - height: 4, - width: 4, - decoration: BoxDecoration( - color: context.accentColor, shape: BoxShape.circle), - ), - FlatButton( - onPressed: () => - 'https://tsacdop.stonegate.me/#/changelog' - .launchUrl, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5)), - child: Text(s.changelog, - style: TextStyle(color: context.accentColor)), - ), - ], - ), - Padding( - padding: EdgeInsets.all(10.0), - ), - Container( - padding: EdgeInsets.only(top: 20.0, bottom: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10)), - border: Border.all( - color: Theme.of(context).accentColor, width: 1), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - s.developer, - style: TextStyle( - color: context.accentColor, - fontWeight: FontWeight.bold), - ), - _listItem(context, 'Twitter', LineIcons.twitter, - 'https://twitter.com/shimenmen'), - _listItem(context, 'GitHub', LineIcons.github_alt, - 'https://github.com/stonega'), - _listItem(context, 'Medium', LineIcons.medium, - 'https://medium.com/@stonegate'), - Center( - child: SizedBox( - width: 200, - child: FlatButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(4.0), - ), - color: Colors.yellow.withAlpha(70), - onPressed: () => - 'https://www.buymeacoffee.com/stonegate' - .launchUrl, - child: Container( - height: 30.0, - padding: EdgeInsets.symmetric(horizontal: 10.0), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text('Buy me a coffee', - style: TextStyle( - fontWeight: FontWeight.bold)), - SizedBox(width: 10), - Image( - image: - AssetImage('assets/buymeacoffee.png'), - height: 20, - fit: BoxFit.fitHeight, - ), - ], + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Text( + // s.developer, + // style: TextStyle( + // color: context.accentColor, + // fontWeight: FontWeight.bold), + // ), + _listItem(context, 'Twitter @tsacdop', + LineIcons.twitter, 'https://twitter.com/tsacdop'), + _listItem(context, 'GitHub', LineIcons.github_alt, + 'https://github.com/stonega/tsacdop'), + _listItem(context, 'Telegram', LineIcons.telegram, + 'https://t.me/joinchat/Bk3LkRpTHy40QYC78PK7Qg'), + Center( + child: SizedBox( + width: 200, + child: ElevatedButton( + onPressed: () => + 'https://www.buymeacoffee.com/stonegate' + .launchUrl, + style: ElevatedButton.styleFrom( + primary: context.accentColor), + child: Container( + height: 30.0, + padding: + EdgeInsets.symmetric(horizontal: 4.0), + alignment: Alignment.center, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Text('Buy me a coffee', + style: TextStyle( + fontWeight: FontWeight.bold)), + SizedBox(width: 10), + Image( + image: AssetImage( + 'assets/buymeacoffee.png'), + height: 20, + fit: BoxFit.fitHeight, + ), + ], + ), ), ), ), ), - ), - Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Text( - 'I need to pay for podcast search API and ' - 'always get headache without caffeine.', - textAlign: TextAlign.center, - style: TextStyle(color: Colors.grey[500]), - ), - ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(10.0), - ), - Container( - padding: EdgeInsets.only(top: 20.0, bottom: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10)), - border: Border.all(color: context.accentColor, width: 1), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - s.translators, - style: TextStyle( - color: Theme.of(context).accentColor, - fontWeight: FontWeight.bold), + Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Text( + 'I need to pay for podcast search API and ' + 'always get headache without caffeine.', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey[500]), ), - SizedBox(width: 2), - Icon(Icons.favorite, color: Colors.red, size: 20), - ], - ), - _translatorInfo(context, name: 'Atrate'), - _translatorInfo(context, name: 'ppp', flag: 'fr'), - _translatorInfo(context, - name: 'Joel Israel', flag: 'mx'), - _translatorInfo(context, - name: 'Bruno Pinheiro', flag: 'pt'), - _translatorInfo(context, - name: 'Edoardo Maria Elidoro', flag: 'it'), - ], - ), - ), - //Spacer(), - Padding( - padding: EdgeInsets.symmetric(vertical: 10), - ), - Container( - height: 50, - alignment: Alignment.center, - child: GestureDetector( - onTapDown: (detail) async { - OverlayEntry _overlayEntry; - _overlayEntry = _createOverlayEntry(detail); - Overlay.of(context).insert(_overlayEntry); - await Future.delayed(Duration(seconds: 2)); - _overlayEntry?.remove(); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/text.png', - height: 25, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5), - ), - Icon( - Icons.favorite, - color: Colors.blue, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5), - ), - FlutterLogo( - size: 18, ), ], ), ), - ), - ], + Padding( + padding: EdgeInsets.all(10.0), + ), + Container( + padding: EdgeInsets.only(top: 20.0, bottom: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10)), + border: + Border.all(color: context.accentColor, width: 1), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + SizedBox(width: 25), + Text( + s.translators, + style: TextStyle( + color: Theme.of(context).accentColor, + fontWeight: FontWeight.bold), + ), + SizedBox(width: 2), + Icon(Icons.favorite, color: Colors.red, size: 20), + ], + ), + _translatorInfo(context, name: 'Atrate'), + _translatorInfo(context, name: 'ppp', flag: 'fr'), + _translatorInfo(context, + name: 'Joel Israel', flag: 'mx'), + _translatorInfo(context, + name: 'Bruno Pinheiro', flag: 'pt'), + _translatorInfo(context, + name: 'Edoardo Maria Elidoro', flag: 'it'), + ], + ), + ), + //Spacer(), + Padding( + padding: EdgeInsets.symmetric(vertical: 10), + ), + Container( + height: 50, + alignment: Alignment.center, + child: GestureDetector( + onTapDown: (detail) async { + OverlayEntry _overlayEntry; + _overlayEntry = _createOverlayEntry(detail); + Overlay.of(context).insert(_overlayEntry); + await Future.delayed(Duration(seconds: 2)); + _overlayEntry?.remove(); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/text.png', + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + ), + Icon( + Icons.favorite, + color: Colors.blue, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + ), + FlutterLogo( + size: 18, + ), + ], + ), + ), + ), + ], + ), ), ), ),