Skip to content

Commit 1e79b1f

Browse files
committed
change on tools name
1 parent 75349d8 commit 1e79b1f

File tree

6 files changed

+27
-43
lines changed

6 files changed

+27
-43
lines changed

lib/main.dart

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:flutter/material.dart';
2-
import 'package:moonlight/config/app_routes.dart';
32
import 'config/config.dart';
43
import 'package:google_mobile_ads/google_mobile_ads.dart';
54

@@ -28,15 +27,13 @@ class MyApp extends StatelessWidget {
2827
title: AppConfig.name,
2928
theme: ThemeData(
3029
primarySwatch: Colors.blue,
30+
useMaterial3: true,
3131
),
3232
// themeMode: ThemeMode.system,
3333
darkTheme: ThemeData.dark(),
3434
themeMode: currentMode,
35-
// initialRoute: rootRoute,
36-
// onGenerateRoute: Routes.generateRoute,
3735
initialRoute: '/',
3836
routes: Routes().routes,
39-
// home: const RegisterScreen(),
4037
);
4138
});
4239
}

lib/utils/tools.dart

+11-21
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,33 @@ import 'package:flutter/material.dart';
22
import 'package:share_plus/share_plus.dart';
33
import 'package:url_launcher/url_launcher.dart';
44

5-
calling(phone) async {
6-
// const url = 'tel:+12345678';
7-
var url = 'tel:' + phone;
8-
if (await canLaunch(url)) {
9-
await launch(url);
10-
} else {
11-
throw 'Could not launch $url';
12-
}
13-
}
14-
15-
void launchURL(url) async {
5+
void mlLaunchURL(url) async {
166
if (!await launch(url)) throw 'Could not launch $url';
177
}
188

19-
void CustomShare(message) async {
9+
void mlShare(message) async {
2010
return Share.share(message);
2111
}
2212

23-
CustomGoBack(BuildContext context) {
13+
mlGoBack(BuildContext context) {
2414
Navigator.pop(context);
2515
}
2616

2717
//new
28-
void _showUrl() {
29-
_launch('http://www.nandiraju.com');
18+
void showUrl(String url) {
19+
_launch(url);
3020
}
3121

32-
void _showEmail(email) {
33-
_launch('mailto:[email protected]');
22+
void showEmail(String email) {
23+
_launch('mailto:$email');
3424
}
3525

36-
void _showTelephone(phone) {
37-
_launch('tel:' + phone);
26+
void showTelephone(String phone) {
27+
_launch('tel:$phone');
3828
}
3929

40-
void _showSms(phone) {
41-
_launch('sms:' + phone);
30+
void showSms(String phone) {
31+
_launch('sms:$phone');
4232
}
4333

4434
void _launch(String urlString) async {

lib/views/home_view.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HomeView extends StatelessWidget {
2323
children: [
2424
ElevatedButton(
2525
onPressed: () {
26-
launchURL(AppLink.officialWebsite);
26+
mlLaunchURL(AppLink.officialWebsite);
2727
},
2828
child: const Text("Official Website")),
2929
const SizedBox(width: 2),

lib/views/load_more_view.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import '../config/config.dart';
3-
import '../widgets/drawer.dart';
43
import 'package:http/http.dart' as http;
54
import 'dart:convert';
65

@@ -19,7 +18,7 @@ class _LoadMoreViewState extends State<LoadMoreView> {
1918

2019
// At the beginning, we fetch the first 20 posts
2120
int _page = 0;
22-
int _limit = 20;
21+
final int _limit = 20;
2322

2423
// There is next page or not
2524
bool _hasNextPage = true;
@@ -97,7 +96,7 @@ class _LoadMoreViewState extends State<LoadMoreView> {
9796
void initState() {
9897
super.initState();
9998
_firstLoad();
100-
_controller = new ScrollController()..addListener(_loadMore);
99+
_controller = ScrollController()..addListener(_loadMore);
101100
}
102101

103102
@override

lib/views/setting_view.dart

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:io';
2-
31
import 'package:flutter/material.dart';
42
import 'package:moonlight/config/config.dart';
53
import '../main.dart';
@@ -48,15 +46,15 @@ class SettingView extends StatelessWidget {
4846
title: Text("Contact Us"),
4947
trailing: Icon(Icons.navigate_next),
5048
onTap: (() {
51-
launchURL(AppLink.contactUs);
49+
mlLaunchURL(AppLink.contactUs);
5250
}),
5351
),
5452
ListTile(
5553
leading: Icon(Icons.help_outline),
5654
title: Text("FAQ"),
5755
trailing: Icon(Icons.navigate_next),
5856
onTap: (() {
59-
launchURL(AppLink.contactUs);
57+
mlLaunchURL(AppLink.contactUs);
6058
}),
6159
),
6260
Center(
@@ -70,7 +68,7 @@ class SettingView extends StatelessWidget {
7068
title: Text("Official Website"),
7169
trailing: Icon(Icons.navigate_next),
7270
onTap: (() {
73-
launchURL(AppLink.officialWebsite);
71+
mlLaunchURL(AppLink.officialWebsite);
7472
}),
7573
)),
7674
Visibility(
@@ -80,7 +78,7 @@ class SettingView extends StatelessWidget {
8078
title: Text("YouTube"),
8179
trailing: Icon(Icons.navigate_next),
8280
onTap: (() {
83-
launchURL(AppLink.youtube);
81+
mlLaunchURL(AppLink.youtube);
8482
}),
8583
)),
8684
Visibility(
@@ -90,7 +88,7 @@ class SettingView extends StatelessWidget {
9088
title: Text("Instagram"),
9189
trailing: Icon(Icons.navigate_next),
9290
onTap: (() {
93-
launchURL(AppLink.instagram);
91+
mlLaunchURL(AppLink.instagram);
9492
}),
9593
)),
9694
Visibility(
@@ -100,7 +98,7 @@ class SettingView extends StatelessWidget {
10098
title: Text("Facebook"),
10199
trailing: Icon(Icons.navigate_next),
102100
onTap: (() {
103-
launchURL(AppLink.facebook);
101+
mlLaunchURL(AppLink.facebook);
104102
}),
105103
)),
106104
Visibility(
@@ -110,7 +108,7 @@ class SettingView extends StatelessWidget {
110108
title: Text("Twitter"),
111109
trailing: Icon(Icons.navigate_next),
112110
onTap: (() {
113-
launchURL(AppLink.twitter);
111+
mlLaunchURL(AppLink.twitter);
114112
}),
115113
)),
116114
Center(
@@ -124,31 +122,31 @@ class SettingView extends StatelessWidget {
124122
title: Text("Terms & Conditions"),
125123
trailing: Icon(Icons.navigate_next),
126124
onTap: (() {
127-
launchURL(AppLink.termsAndConditions);
125+
mlLaunchURL(AppLink.termsAndConditions);
128126
}),
129127
),
130128
ListTile(
131129
leading: Icon(Icons.info),
132130
title: Text("About Us"),
133131
trailing: Icon(Icons.navigate_next),
134132
onTap: (() {
135-
launchURL(AppLink.aboutUs);
133+
mlLaunchURL(AppLink.aboutUs);
136134
}),
137135
),
138136
ListTile(
139137
leading: Icon(Icons.share),
140138
title: Text("Share The App"),
141139
trailing: Icon(Icons.navigate_next),
142140
onTap: (() {
143-
CustomShare(AppConfig.shareTheAppMsg);
141+
mlShare(AppConfig.shareTheAppMsg);
144142
}),
145143
),
146144
ListTile(
147145
leading: Icon(Icons.star),
148146
title: Text("Rate This App"),
149147
trailing: Icon(Icons.navigate_next),
150148
onTap: (() {
151-
launchURL(AppConfig.rateThisAppLink);
149+
mlShare(AppConfig.rateThisAppLink);
152150
}))
153151
],
154152
),

pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ packages:
155155
name: google_mobile_ads
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "2.1.0"
158+
version: "2.2.0"
159159
http:
160160
dependency: "direct main"
161161
description:

0 commit comments

Comments
 (0)