0

私はコミュニティのためのツールを書いています。私の目的は、リストタイルに姓名と番号を付け、人々が名前をクリックすると、割り当てられた番号にダイヤルすることです。url_launcher を試しましたが、できませんでした。コードの何が問題なのかを確認して教えてくれます。これは、起動できなかった私のコードです。見逃しているものはありますか?


     import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:sarisayfav1/Gas.dart';
import 'package:sarisayfav1/Kargo.dart';
import 'package:sarisayfav1/Tamir.dart';
import 'package:url_launcher/url_launcher.dart';

import 'Book.dart';
import 'Food.dart';

class Arac extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Akcakale Sari Sayfa',
      theme: ThemeData(
        backgroundColor: Colors.black87,
        primaryColor: Colors.black,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Akçakale Sarı Sayfa'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        child: ListView(
          // Important: Remove any padding from the ListView.

          padding: EdgeInsets.zero,
          children: <Widget>[
            DrawerHeader(
              child: Text('Akçakale Sarı Sayfa Uygulaması',
                  style: TextStyle(color: Colors.amberAccent, fontSize: 25)),
              decoration: BoxDecoration(
                color: Colors.black87,
              ),
            ),
            ListTile(
              leading: Icon(Icons.directions_bus),
              title: Text(
                'Kargo Telefon Numaraları',
              ),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Kargo()));
                // Update the state of the app.
                // ...
              },
            ),
            ListTile(
              leading: Icon(Icons.food_bank_outlined),
              title: Text(
                'Lokanta-Yiyecek-İçecek',
              ),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Food()));
                // Update the state of the app.
                // ...
              },
            ),
            ListTile(
              leading: Icon(Icons.menu_book_rounded),
              title: Text(
                'Kırtasiye-Kitapçı',
              ),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Book()));
                // Update the state of the app.
                // ...
              },
            ),
            ListTile(
              leading: Icon(Icons.local_gas_station),
              title: Text('Tüpçü-Sucu'),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Gas()));
              },
            ),
            ListTile(
              leading: Icon(Icons.home_repair_service),
              title: Text(
                'Elektrik-Su-Mobilya Tamircisi',
              ),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Tamir()));
                // Update the state of the app.
                // ...
              },
            ),
            ListTile(
              leading: Icon(Icons.local_taxi),
              title: Text('Taşıma Hizmeti Sağlayan Özel Araç Sahipleri'),
              onTap: () {
                Navigator.push(context,
                    new MaterialPageRoute(builder: (context) => new Arac()));
              },
            ),
          ],
        ),
      ),
      appBar: AppBar(
        leading: Icon(Icons.settings),
        backgroundColor: Colors.black87,
        title: Text(widget.title, style: TextStyle(color: Colors.amberAccent)),
      ),
      body: ListTile(
        leading: Icon(Icons.person),
        dense: true,
        onTap: () => tel:+123456789,
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

4

1 に答える 1