Home > database >  How i can make my code working with this architecture?
How i can make my code working with this architecture?

Time:12-10

I have a problem, i wan't make this.

And i already got this but i can't make the card next to, i tried ListTile, or just a text but i don't have the good result.


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

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          const Image(image: AssetImage(''),),
          const SizedBox(height: 20),
          Row( 
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: [
              Avatar( 
                elevation: 5,
                shadowColor: Colors.black,
                sources: [
                  NetworkSource("",)
                ],
                shape: AvatarShape.rectangle(100, 100, const BorderRadius.all(Radius.circular(20.0))),
              ),
              Container (
                height: 110.0,
                child : Card (
                  color: const Color(0xFFD5EDE0),
                  elevation: 5,
                  shadowColor: Colors.black,
                  shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(20)
                ),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: const <Widget>[
                    Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
                  ]
                )
              )
              ),
            ]
          ),
          const Align(
              alignment: Alignment(-0.8, 0.0),
              child: Text("La séléction du mois", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
          ),
          const SizedBox(height: 15),
          Carouselslide(colors: const Color(0xFFD5EFF1), duree: const Duration(seconds: 7), list: list),
          const SizedBox(height: 15,),
          const Align(
              alignment: Alignment(-0.8, 0.0),
              child: Text("Les incontournables", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
          ),
          const SizedBox(height: 15,),
          Carouselslide(colors: const Color(0xFFEDD5EB), duree: const Duration(seconds: 5), list: list,),
                    const SizedBox(height: 15,),
          const Align(
              alignment: Alignment(-0.8, 0.0),
              child: Text("Nouveaux produits", style: TextStyle(color: Color(0xFF005126), fontFamily: 'Jost', fontWeight: FontWeight.w500), textScaleFactor: 1.4,),
          ),
          const SizedBox(height: 15,),
          Carouselslide(colors: const Color(0xFFD5EDE0), duree: const Duration(seconds: 6), list: list,),
          const SizedBox(height: 50,),
        ],
      ),
    );
  }
}

CodePudding user response:

Replace your:

  child: Row(
    crossAxisAlignment: CrossAxisAlignment.center,
    children: const <Widget>[
      Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),
    ]
  )

with:

  child: Padding(
    padding: const EdgeInsets.all(10), // Padding will prevent your text touching the borders
    child: Center( // Center widget centers vertically
      child: Text(
        "Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!",
        textAlign: TextAlign.center, // Center horizontally
      ),
    ),
  ),

CodePudding user response:

Wrap with the Expanded:

        Expanded(child:
          Container (
            height: 110.0,
            child : Card (
              color: const Color(0xFFD5EDE0),
              elevation: 5,
              shadowColor: Colors.black,
              shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20)
            ),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: const <Widget>[
                Expanded(child: Text("Tu n’as pas encore de point gaspi! Rempli tes missions pour bénéficier de nos cadeaux Apprenti fleury!"),),
              ]
            )
          )
          ),),
  • Related