Container(
          width: double.infinity,
          height: 1,
          color: Colors.black,
        ),

全体のソース

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Draw 3 Lines Across Screen Width'),
        ),
        body: Column(
          children: [
            SizedBox(height: 10,),
            Container(
              width: double.infinity,
              height: 5,
              color: Colors.blue,
            ),
            SizedBox(height: 10,),
            Container(
              width: double.infinity,
              height: 5,
              color: Colors.red,
            ),
            SizedBox(height: 10,),
            Container(
              width: double.infinity,
              height: 5,
              color: Colors.green,
            ),
          ],
        ),
      ),
    );
  }
}

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha