need to enter phone number by the user

10 views
Skip to first unread message

Abinavan Nagendran

unread,
Jun 15, 2020, 6:34:03 AM6/15/20
to Flutter Development (flutter-dev)
Hi this is the code.. Here im creating an app in which user need to enter phone number of the receiver in a textfield to send sms. 
I need to have inbuilt msg once the msg clicked and number which is given need to be given by user 
this is my code,
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
       
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'SmS page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  void customLaunch(command) async {
    if (await canLaunch(command)) {
      await launch(command);
    } else {
      print(' could not launch $command');
    }
  }

  @override
  Widget build(BuildContext context) {    
    return Scaffold(
      appBar: AppBar(        
        title: Text(widget.title),
      ),
      body: Center(
        
        child: Column(
         
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Row(
              children: <Widget>[
               
        
                RaisedButton(
                  onPressed: () {
                    customLaunch('sms:123456789');
                  },
                  child: Text('SMS'),
                ),
              ],
            )
          ],
        ),
      ),
      
    );
  }
}

Can you help me to sort out the problem?
Thank you. 

Suzuki Tomohiro

unread,
Jun 15, 2020, 7:46:49 AM6/15/20
to Abinavan Nagendran, Flutter Development (flutter-dev)
Do you want to explain the problem? (Error message?)

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/d6cbccd7-4e90-46cf-b806-81eb0ac46340o%40googlegroups.com.

Suzuki Tomohiro

unread,
Jun 16, 2020, 8:23:48 AM6/16/20
to Abinavan Nagendran, Flutter Development (flutter-dev)
Do you know how to
- Go to the messaging app
- Show inbuild msg
?

(Not sure what “inbuild msg” is)


On Tue, Jun 16, 2020 at 02:53 Abinavan Nagendran <abina...@gmail.com> wrote:
no sir .. the code is executing but my requirement is ithat I want to make an inbuilt msg while onpressed function is pressed.
like I need to click "ON" button, once it is clicked i want to perform 2 function: 
1)need to go to the messaging app.
2) there need to a inbuilt msg Like Motor On 

Abinavan Nagendran

unread,
Jun 17, 2020, 5:04:43 AM6/17/20
to Flutter Development (flutter-dev)
inbuilt message .means 
Once the button is pressed the text "motor ON" need to send to the receiver
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Souvik Dutta

unread,
Jun 17, 2020, 5:07:37 AM6/17/20
to Abinavan Nagendran, Flutter Development (flutter-dev)
What error did you get? 

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/637eea63-ae91-4192-bfb6-50e864474a02o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages