This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
comptaplan_app/lib/winbooks_migration_widget.dart
cghislai ea85f7838a
Some checks failed
gestemps/comptaplanapp/pipeline/head There was a failure building this commit
Winbooks Connect migration
2022-01-19 19:11:31 +01:00

84 lines
2.9 KiB
Dart

import 'dart:io';
import 'package:android_intent_plus/android_intent.dart';
import 'package:flutter/material.dart';
class WinbooksMigrationWidget extends StatefulWidget {
final String _playStoreUrl;
final String _title;
const WinbooksMigrationWidget(this._title, this._playStoreUrl, {Key? key}) : super(key: key);
@override
WinbooksMigrationWidgetState createState() => WinbooksMigrationWidgetState();
}
class WinbooksMigrationWidgetState extends State<WinbooksMigrationWidget> {
WinbooksMigrationWidgetState();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context);
TextStyle largerTextStyle = themeData.textTheme.bodyText1!.apply(fontSizeFactor: 1.4);
TextStyle smallerTextStyle = themeData.textTheme.bodyText2!;
AssetBundle assetBundle = DefaultAssetBundle.of(context);
return Scaffold(
appBar: AppBar(
title: Text(widget._title),
),
body: GridView.count(
crossAxisCount: 1,
children: [
Column(children: [
Container(
margin: const EdgeInsets.all(10.0),
child: Text(
'My comptaplan migre vers WinBooks Connect. Téléchargez WinBooks Connect pour continuer à envoyer vos fichiers à votre comptable',
textAlign: TextAlign.center,
style: largerTextStyle),
),
Center(
child: Container(
margin: const EdgeInsets.all(10.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(textStyle: largerTextStyle, padding: const EdgeInsets.all(20.0)),
child: Row(children: [
Image.asset('images/winbooks_connect.png', bundle: assetBundle, width: 50.0, height: 50.0),
const SizedBox(width: 10),
const Text('Télécharger WinBooks Connect')
]),
onPressed: () async {
return _onWinbooksConnectPress();
},
),
),
),
Container(
margin: const EdgeInsets.all(10.0),
child: Text(
'Si vous ne parvenez pas à télécharger Winbooks Connect, ou pour obtenir vos identifiants, veuillez contacter votre comptable.',
textAlign: TextAlign.left,
style: smallerTextStyle),
),
])
],
));
}
Future<void> _onWinbooksConnectPress() async {
if (Platform.isAndroid) {
AndroidIntent intent = AndroidIntent(
action: 'action_view',
data: widget._playStoreUrl,
package: 'com.android.vending',
);
return intent.launch();
}
}
}