Diyorbek Tuxtapulatov
Diyorbek Tuxtapulatov

Reputation: 11

I can not fixed this problem I Create Navbar and Create Account design in Navbar but I can See only blank page

RenderBox was not laid out:

_RenderListTile#934f1 relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE 'package:flutter/src/rendering/box.dart': Failed assertion: line 2001 pos 12: 'hasSize' I meet this problem !!

import 'package:flutter/material.dart';

class SettingsScreen extends StatelessWidget {
  const SettingsScreen({Key? key}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Padding(
        padding: EdgeInsets.only(
          top: 50,
          right: 20,
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              'Settings',
              style: TextStyle(
                fontSize: 30,
                fontWeight: FontWeight.w500,
              ),
            ),
            Row(
              children: [
                ListTile(
                  onTap: (){},
                  leading: CircleAvatar(
                    radius: 30,
                    backgroundImage: AssetImage('assetimage/doctor1.jpg'),
                  ),
                  title: Text(
                    'Dr Doctor Name',
                    style: TextStyle(
                      fontWeight: FontWeight.w500,
                      fontSize: 25,
                    ),
                  ),
                  subtitle: Text(
                    'Profile',
                  ),
                ),
              ],
            ),
            Divider(
              height: 50,
            ),
            ListTile(
              onTap: () {},

              leading: Container(
                padding: EdgeInsets.all(8.0),
                decoration: BoxDecoration(
                  color: Colors.blue.shade100,
                  shape: BoxShape.circle,

                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

I write it and see blank page

Upvotes: 1

Views: 38

Answers (1)

Jaimin Raval
Jaimin Raval

Reputation: 526

You have wrapped ListTile with Row maybe that's causing error.Please use below code.

    import 'package:flutter/material.dart';

class SettingsScreen extends StatelessWidget {
  const SettingsScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Padding(
          padding: EdgeInsets.only(
            top: 50,
            right: 20,
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                'Settings',
                style: TextStyle(
                  fontSize: 30,
                  fontWeight: FontWeight.w500,
                ),
              ),
              ListTile(
                onTap: (){},
                leading: CircleAvatar(
                  radius: 30,
                  backgroundImage: AssetImage('assetimage/doctor1.jpg'),
                ),
                title: Text(
                  'Dr Doctor Name',
                  style: TextStyle(
                    fontWeight: FontWeight.w500,
                    fontSize: 25,
                  ),
                ),
                subtitle: Text(
                  'Profile',
                ),
              ),
              Divider(),
              ListTile(
                onTap: (){},
                leading: CircleAvatar(
                  radius: 30,
                  backgroundImage: AssetImage('assetimage/doctor1.jpg'),
                ),
                title: Text(
                  'Dr Doctor Name',
                  style: TextStyle(
                    fontWeight: FontWeight.w500,
                    fontSize: 25,
                  ),
                ),
                subtitle: Text(
                  'Profile',
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Output :

enter image description here

Upvotes: 0

Related Questions