open-mail-app-flutter
이 라이브러리는 장치에 설치된 이메일 앱을 쿼리하고 해당 앱을 열 수 있는 기능을 제공합니다.
- 스타
- 37
- 포크
- 175
- 최근 푸시(UTC)
- 2024. 1. 17.
- 프로젝트 상태
- 보관됨
원본 README
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Open Mail App Flutter 
A boring but accurate name.
This library provides the ability to query the device for installed email apps and open those apps.
If you just want to compose an email or open any app with a mailto: link, you are looking for url_launcher.
Why
While url_launcher can help you compose an email or open the default email app, it doesn't give you control over which is opened and it doesn't tell you what is available on the device. This is especially a problem on iOS where only the default Mail app will be opened, even if the user prefers a different app.
Setup
iOS requires you to list the URL schemes you would like to query in the Info.plist file.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlegmail</string>
<string>x-dispatch</string>
<string>readdle-spark</string>
<string>airmail</string>
<string>ms-outlook</string>
<string>ymail</string>
<string>fastmail</string>
<string>superhuman</string>
<string>protonmail</string>
</array>
Please file issues to add popular email apps you would like to see on iOS. They need to be added to both your app's Info.plist and in the source of this library.
Usage
Open Mail App With Picker If Multiple
import 'package:open_mail_app/open_mail_app.dart';
void main() {
runApp(MaterialApp(home: MyApp()));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RaisedButton(
child: Text("Open Mail App"),
onPressed: () async {
// Android: Will open mail app or show native picker.
// iOS: Will open mail app if single mail app found.
var result = await OpenMailApp.openMailApp();
// If no mail apps found, show error
if (!result.didOpen && !result.canOpen) {
showNoMailAppsDialog(context);
// iOS: if multiple mail apps found, show dialog to select.
// There is no native intent/default app system in iOS so
// you have to do it yourself.
} else if (!result.didOpen && result.canOpen) {
showDialog(
context: context,
builder: (_) {
return MailAppPickerDialog(
mailApps: result.options,
);
},
);
}
},
);
}
void showNoMailAppsDialog(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text("Open Mail App"),
content: Text("No mail apps installed"),
actions: <Widget>[
FlatButton(
child: Text("OK"),
onPressed: () {
Navigator.pop(context);
},
)
],
);
},
);
}
}
사용 중인 의존성
의존성 목록 4 개
- platform
^3.1.0 - url_launcher
^6.0.2 - flutter
{"sdk":"flutter"} - flutter_test개발 의존성
{"sdk":"flutter"}
프로젝트에 맞는 저장소를 선택하려면?
사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
- 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
- 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
- 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.
출처 및 관리
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗