Advertisement
Guest User

view

a guest
Jan 20th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.65 KB | None | 0 0
  1. import 'dart:convert';
  2. import 'package:barbershop/selectday_page.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart' show rootBundle;
  5. import 'JsonModel_page.dart';
  6.  
  7. // Future<String> localJsonAsset() async {
  8. //   return await rootBundle.loadString('assets/data/example.json');
  9. // }
  10.  
  11. var jsonUrl = 'https://www.pointscard.moeasy.it/jsonUrl.json';
  12.  
  13. class PrenotationsPage extends StatefulWidget {
  14.   PrenotationsPage({Key key, this.title}) : super(key: key);
  15.   final String title;
  16.  
  17.   @override
  18.   _MyPrenotationsPage createState() => _MyPrenotationsPage();
  19. }
  20.  
  21. class _MyPrenotationsPage extends State<PrenotationsPage> {
  22.   @override
  23.   void initState() {
  24.     super.initState();
  25.   }
  26.  
  27.   ServiceList serviceList = ServiceList.fromRawJson(jsonUrl);
  28.  
  29.   @override
  30.   Widget build(BuildContext context) {
  31.     return MaterialApp(
  32.       home: Scaffold(
  33.         appBar: new AppBar(
  34.           backgroundColor: Colors.transparent,
  35.           elevation: 0,
  36.           title: new Text(
  37.             "SELEZIONA SERVIZI",
  38.             style: TextStyle(
  39.                 fontSize: 16.0,
  40.                 color: Colors.black,
  41.                 fontWeight: FontWeight.bold,
  42.                 letterSpacing: 1),
  43.           ),
  44.           centerTitle: true,
  45.           leading: IconButton(
  46.             icon: Icon(Icons.arrow_back),
  47.             color: Colors.black,
  48.             onPressed: () => Navigator.pop(context),
  49.           ),
  50.         ),
  51.         body: Column(
  52.           children: <Widget>[
  53.             ListView.builder(
  54.               shrinkWrap: true,
  55.               padding: const EdgeInsets.all(8.0),
  56.               itemCount: 3,
  57.               itemBuilder: (BuildContext context, int index) {
  58.                 return ExpansionTile(
  59.                   title: Text("serviceList[index].tipologia"),
  60.                   children: <Widget>[
  61.                     CheckboxListTile(
  62.                       title: Text("serviceList[index].servizi[index].nome"),
  63.                       value: false,
  64.                       //   onChanged: (val) {
  65.                       //     setState(() {
  66.                       //       ServiceList().servizio[index].isActive = val;
  67.                       //     });
  68.                       //   },
  69.                     ),
  70.                   ],
  71.                 );
  72.               },
  73.             ),
  74.             RaisedButton(
  75.               // SENDING TO BACKEND
  76.               onPressed: () => Navigator.push(
  77.                 context,
  78.                 MaterialPageRoute(builder: (context) => SelectdayPage()),
  79.               ),
  80.               child: Text("Aventi"),
  81.             ),
  82.           ],
  83.         ),
  84.       ),
  85.     );
  86.   }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement