ボタンを押下で、生成したメールの送信画面に進みたい。
ボタン押下時に呼び出したウィジェットがキャンセルされてしまうようで実行されない。
エラーメッセージは以下の通りです。
I/ViewRootImpl(16233): ViewRoot's Touch Event : ACTION_DOWN
I/ViewGroup(16233): ACTION_DOWN: android.widget.LinearLayout{b7c095f V.E...... ........ 0,0-1080,2418}
I/ViewGroup(16233): ACTION_DOWN: android.widget.FrameLayout{8a88dfe V.E...... ........ 0,0-1080,2418 #1020002 android:id/content}
I/ViewGroup(16233): ACTION_DOWN: io.flutter.embedding.android.FlutterView{1ddd5b9 VFED..... ........ 0,0-1080,2418 #1}
I/ViewGroup(16233): ACTION_DOWN: io.flutter.embedding.android.FlutterSurfaceView{d251fac V.E...... ........ 0,0-1080,2418}
I/ViewRootImpl(16233): ViewRoot's Touch Event : ACTION_UP
I/ViewGroup(16233): ACTION_UP: android.widget.LinearLayout{b7c095f V.E...... ........ 0,0-1080,2418}
I/ViewGroup(16233): ACTION_UP: android.widget.FrameLayout{8a88dfe V.E...... ........ 0,0-1080,2418 #1020002 android:id/content}
I/ViewGroup(16233): ACTION_UP: io.flutter.embedding.android.FlutterView{1ddd5b9 VFED..... ........ 0,0-1080,2418 #1}
E/flutter (16233): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(not_available, No email clients found!, null, null)
E/flutter (16233): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (16233): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (16233): <asynchronous suspension>
E/flutter (16233): #2 _MyHomePageState._sendEmail (package:design/main.dart:126:5)
E/flutter (16233): <asynchronous suspension>
flutter
1import 'package:flutter/material.dart'; 2import 'package:flutter_email_sender/flutter_email_sender.dart'; 3 4void main() => runApp(const MyApp()); 5 6class MyApp extends StatelessWidget { 7 const MyApp({Key? key}) : super(key: key); 8 9 // This widget is the root of your application. 10 @override 11 Widget build(BuildContext context) { 12 return MaterialApp( 13 title: 'ロクモッティ', 14 theme: ThemeData.dark(), 15 home: const MyHomePage(title: 'レジプロ報告'), 16 ); 17 } 18} 19 20class MyHomePage extends StatefulWidget { 21 const MyHomePage({Key? key, required this.title}) : super(key: key); 22 final String title; 23 24 @override 25 State<MyHomePage> createState() => _MyHomePageState(); 26} 27 28class _MyHomePageState extends State<MyHomePage> { 29 30 @override 31 Widget build(BuildContext context) { 32 return Scaffold( 33 appBar: AppBar( 34 // Here we take the value from the MyHomePage object that was created by 35 // the App.build method, and use it to set our appbar title. 36 title: Text(widget.title), 37 ), 38 body: Stack( 39 40 children: [ 41 Column( 42 children: [ 43 Container( 44 height: 600, 45 ), 46 Container( 47 child: Row( 48 // 均等配置 49 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 50 children: <Widget>[ 51 SizedBox( 52 height: 80, 53 child: ElevatedButton( 54 child: Text(" 所感 ", 55 style: TextStyle( 56 color: Colors.black, 57 ), 58 ), 59 style: ElevatedButton.styleFrom( 60 primary: Colors.greenAccent, 61 onPrimary: Colors.white, 62 ), 63 onPressed: (){}, 64 ), 65 ), 66 SizedBox( 67 height: 80, 68 child: ElevatedButton( 69 child: Text("経費申請", 70 style: TextStyle( 71 color: Colors.black, 72 ), 73 ), 74 style: ElevatedButton.styleFrom( 75 primary: Colors.yellow, 76 onPrimary: Colors.white, 77 ), 78 onPressed: (){}, 79 ), 80 ), 81 SizedBox( 82 height: 80, 83 child: ElevatedButton( 84 child: Text("終了報告", 85 style: TextStyle( 86 color: Colors.black, 87 ), 88 ), 89 style: ElevatedButton.styleFrom( 90 primary: Colors.orange, 91 onPrimary: Colors.white, 92 ), 93 onPressed: (){}, 94 ), 95 ), 96 //ー↓↓↓↓↓↓↓↓↓↓↓↓今回作りたいのはこの部分のみです。↓↓↓↓↓↓↓↓↓↓↓↓↓ 97 SizedBox( 98 height: 80, 99 child: ElevatedButton( 100 child: Text("出発報告", 101 style: TextStyle( 102 color: Colors.black, 103 ), 104 ), 105 style: ElevatedButton.styleFrom( 106 primary: Colors.red, 107 onPrimary: Colors.white, 108 ), 109 onPressed: _sendEmail, 110 ), 111 ), 112 ], 113 ), 114 ),], 115 ),], 116 ), 117 ); 118 } 119 Future<void> _sendEmail() async { 120 final email = Email( 121 body: 'test', 122 subject: 'test', 123 recipients: ['****@****'], 124 bcc: ['*****@****'], 125 ); 126 127 await FlutterEmailSender.send(email); 128 } 129} 130 //ー↑↑↑↑↑↑↑↑↑↑↑↑↑↑今回作りたいのはこの部分のみです。↑↑↑↑↑↑↑↑↑↑↑↑↑↑
ご助力賜りますようお願い申し上げます。ボールドテキスト
回答1件
あなたの回答
tips
プレビュー