Review my code

15 views
Skip to first unread message

HIMANSHU MISHRA

unread,
Apr 22, 2021, 8:55:46 AM4/22/21
to Flutter Development (flutter-dev)
Hello Everyone,

I have to create the attached screen. I have started like this. Am I going right way? If yes then suggest me the next step to load data on screen as shown below in mockup. Here is my code:

import 'dart:convert';

import 'package:conqer_music/App/widgets/AppBarWidget.dart';
import 'package:conqer_music/App/widgets/BottomNavigation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:http/http.dart';
import 'package:material_floating_search_bar/material_floating_search_bar.dart';
import 'package:http/http.dart' as http;
import 'package:conqer_music/App/navigationDrawer/navigationDrawer.dart';

// ignore: camel_case_types
class albumsPage extends StatefulWidget {
  static const String routeName = '/albumsPage';
  @override
  _albumsPageState createState() => _albumsPageState();
}

// ignore: camel_case_types
class _albumsPageState extends State<albumsPage> {
  Future<voidalbumList() async {
    print('Hello');
    onLoading();
    try {
      final response = await http.get(
      );
      print(response);
      if (response.statusCode == 200) {
        Navigator.pop(context);
        setState(() {
          Map data = jsonDecode(response.body);
          String resStatus = data['res_status'];
          print(data);
        });
      }
    } catch (e) {
      print('Some Error:$e');
    }
  }

  onLoading() {
    showDialog(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return Center(
          child: Container(
            height: 50,
            width: 50,
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                new CircularProgressIndicator(
                  backgroundColor: Color(0xFFbaa15e),
                ),
                // new Text("Loading..."),
              ],
            ),
          ),
        );
      },
    );
  }

  Widget albumData() {
    return SafeArea(
      child: new Scaffold(
          appBar: AppBar(
            title: Text("Album"),
            centerTitle: true,
            actions: <Widget>[
              AppBarWidget(),
            ],
          ),
          drawer: navigationDrawer(),
          body: Center(child: Text("This is Album page"))),
    );
  }

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: albumList(),
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          return albumData();
        }
        return albumData(); // or some other widget
      },
    );
  }
}

12.png

Suzuki Tomohiro

unread,
Apr 22, 2021, 9:45:53 AM4/22/21
to HIMANSHU MISHRA, Flutter Development (flutter-dev)
What does your UI look like now? (Needs screenshots)
From your perspective, what's the current gap?

--
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/CAJySXU-PMBgwB-caU411Sw101rNzoCtLfMhnCie2bOf1RP4caA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages