|
| 1 | +// import 'package:flutter/material.dart'; |
| 2 | +// import 'package:flutter/services.dart'; |
| 3 | +// import 'package:provider/provider.dart'; |
| 4 | +// import 'package:haider_app/screens/business_overview_screen.dart'; |
| 5 | +// import 'package:haider_app/screens/splash_screen.dart'; |
| 6 | + |
| 7 | +// import './screens/login_screen.dart'; |
| 8 | + |
| 9 | +// import './providers/auth.dart'; |
| 10 | + |
| 11 | +// Future main() async { |
| 12 | +// WidgetsFlutterBinding.ensureInitialized(); |
| 13 | +// await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); |
| 14 | +// runApp(MyApp()); |
| 15 | +// } |
| 16 | + |
| 17 | +// class MyApp extends StatelessWidget { |
| 18 | +// @override |
| 19 | +// Widget build(BuildContext context) { |
| 20 | +// return MultiProvider( |
| 21 | +// providers: [ |
| 22 | +// ChangeNotifierProvider( |
| 23 | +// create: (context) => Auth(), |
| 24 | +// ), |
| 25 | +// ], |
| 26 | +// child: Consumer<Auth>(builder: (ctx, auth, _) { |
| 27 | +// // print(auth.isAuth); |
| 28 | +// return MaterialApp( |
| 29 | +// debugShowCheckedModeBanner: false, |
| 30 | +// title: '''Haider's App''', |
| 31 | +// theme: ThemeData( |
| 32 | +// scaffoldBackgroundColor: Colors.white, |
| 33 | +// primaryColor: Color.fromRGBO(124, 116, 146, 1), |
| 34 | +// buttonTheme: ButtonThemeData(textTheme: ButtonTextTheme.primary), |
| 35 | +// appBarTheme: AppBarTheme( |
| 36 | +// color: Colors.white, |
| 37 | +// elevation: 0.0, |
| 38 | +// iconTheme: |
| 39 | +// IconThemeData(color: Color.fromRGBO(124, 116, 146, 1))), |
| 40 | +// ), |
| 41 | +// home: auth.isAuth |
| 42 | +// ? BusinessOverViewScreen() |
| 43 | +// : FutureBuilder( |
| 44 | +// builder: (context, authResultSnapshot) { |
| 45 | +// print(auth.isAuth); |
| 46 | +// return authResultSnapshot.connectionState == |
| 47 | +// ConnectionState.waiting |
| 48 | +// ? SplashScreen() |
| 49 | +// : LoginScreen(); |
| 50 | +// }, |
| 51 | +// future: auth.tryAutoLogin(), |
| 52 | +// ), |
| 53 | +// routes: { |
| 54 | +// LoginScreen.routeName: (ctx) => LoginScreen(), |
| 55 | +// // RegisterScreen.routeName: (ctx) => RegisterScreen(), |
| 56 | +// BusinessOverViewScreen.routeName: (ctx) => |
| 57 | +// BusinessOverViewScreen() |
| 58 | +// }, |
| 59 | +// ); |
| 60 | +// })); |
| 61 | +// } |
| 62 | +// } |
| 63 | +// import 'package:flutter/material.dart'; |
| 64 | +// import 'package:flutter/services.dart'; |
| 65 | +// import 'package:sms_maintained/sms.dart'; |
| 66 | + |
| 67 | +// Future main() async { |
| 68 | +// WidgetsFlutterBinding.ensureInitialized(); |
| 69 | +// await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); |
| 70 | +// runApp( |
| 71 | +// MaterialApp( |
| 72 | +// home: SendSmsScreen(), |
| 73 | +// ), |
| 74 | +// ); |
| 75 | +// } |
| 76 | + |
| 77 | +// class SendSmsScreen extends StatelessWidget { |
| 78 | +// final SmsSender sender = SmsSender(); |
| 79 | +// final SmsMessage message = SmsMessage('03009640742', '_body'); |
| 80 | +// final List<SmsMessage> smsList = [ |
| 81 | +// SmsMessage('03009750742', 'Random'), |
| 82 | +// SmsMessage('03008750742', 'Kaleem'), |
| 83 | +// SmsMessage('03056750742', 'Shahryar'), |
| 84 | +// SmsMessage('03127750742', 'Shahryar Zong') |
| 85 | +// ]; |
| 86 | +// @override |
| 87 | +// Widget build(BuildContext context) { |
| 88 | +// return Scaffold( |
| 89 | +// appBar: AppBar(), |
| 90 | +// body: ListView.builder( |
| 91 | +// itemCount: smsList.length, |
| 92 | +// itemBuilder: (context, index) { |
| 93 | +// return SingleChildScrollView( |
| 94 | +// child: Column( |
| 95 | +// children: [ |
| 96 | +// IconButton( |
| 97 | +// icon: Icon(Icons.send), |
| 98 | +// onPressed: () { |
| 99 | +// sender.sendSms(smsList[index]); |
| 100 | +// }, |
| 101 | +// ), |
| 102 | +// StreamBuilder<SmsMessageState>( |
| 103 | +// key: GlobalKey(debugLabel: 'String $index'), |
| 104 | +// // initialData: SmsMessageState.None, |
| 105 | +// builder: (context, snapshot) { |
| 106 | +// if (snapshot.data == SmsMessageState.Sent) { |
| 107 | +// return Text('Message Sent'); |
| 108 | +// } |
| 109 | +// if (snapshot.data == SmsMessageState.Delivered) { |
| 110 | +// return Text('Message Delivered'); |
| 111 | +// } |
| 112 | +// if (snapshot.data == SmsMessageState.Sending) { |
| 113 | +// return Text('Sending'); |
| 114 | +// } |
| 115 | +// if (snapshot.data == SmsMessageState.Fail) |
| 116 | +// return Text('Sending Failed'); |
| 117 | +// return Text('Error'); |
| 118 | +// }, |
| 119 | +// stream: smsList[index].onStateChanged, |
| 120 | +// ), |
| 121 | +// ], |
| 122 | +// ), |
| 123 | +// ); |
| 124 | +// }, |
| 125 | +// )); |
| 126 | +// } |
| 127 | +// } |
1 | 128 | import 'package:flutter/material.dart'; |
2 | 129 | import 'package:woosignal/models/response/products.dart'; |
| 130 | +import 'package:woosignal/models/response/customer_batch.dart'; |
3 | 131 | import 'package:woosignal/woosignal.dart'; |
4 | 132 |
|
5 | 133 | void main() => runApp(MyApp()); |
@@ -31,16 +159,20 @@ class _MyHomePageState extends State<MyHomePage> { |
31 | 159 |
|
32 | 160 | _incrementCounter() async { |
33 | 161 | // CONFIG FOR WOOSIGNAL |
34 | | - var wsConfig = {"appKey": "your app key", "debugMode": true}; |
| 162 | + var wsConfig = { |
| 163 | + "appKey": |
| 164 | + "app_affb6434339b34443a297c2e40a3edab7102137e6d67de9abfe612b749bd", |
| 165 | + "debugMode": true |
| 166 | + }; |
35 | 167 |
|
36 | 168 | // CREATING AN INSTANCE |
37 | 169 | WooSignal wooSignal = await WooSignal.getInstance(config: wsConfig); |
38 | 170 |
|
39 | | - List<Product> products = await wooSignal.getProducts(); |
40 | | - print(products[0].name); |
| 171 | + Customers coupons = await wooSignal.retrieveCustomer(id: 2); |
| 172 | + print(coupons.email); |
41 | 173 |
|
42 | 174 | setState(() { |
43 | | - _productName = products[0].name; |
| 175 | + _productName = coupons.email; |
44 | 176 | }); |
45 | 177 | } |
46 | 178 |
|
|
0 commit comments