> For the complete documentation index, see [llms.txt](https://kodestat.gitbook.io/flutter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kodestat.gitbook.io/flutter/41-flutter-using-custom-widgets.md).

# 41 Flutter: Using Custom Widgets

{% code title="main.dart" %}

```dart
import 'package:flutter/material.dart';
import 'package:tutorial/widgets.dart';

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

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {

    return new MaterialApp(
      title: 'Flutter Demo',
      home: new Texty(),
    );
  }

}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>{
  @override
  Widget build(BuildContext context) {

    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Flutter Demo'),
      ),
      body: new Center(
        child: new Text(''),
      ),
    );

  }
}
```

{% endcode %}

{% code title="widgets.dart" %}

```dart
import 'package:flutter/material.dart';

class Texty extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Container(child: new Text('This works'));
  }
}

```

{% endcode %}
